Merge branch 'develop' of github.com:Dolibarr/dolibarr into dev_fix_createLineWithCOrrectLink
This commit is contained in:
commit
eaa9d22783
24
.github/workflows/stale-issues-safe.yml
vendored
Normal file
24
.github/workflows/stale-issues-safe.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
|
||||
name: "Close stale issues (bugs and feature requests)"
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 21 * * *"
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: DeMoorJasper/stale@master
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 15 days (you should still be able to re-open it if required).'
|
||||
stale-label: 'Issue Stale (automatic label)'
|
||||
exempt-label: 'Priority High / Blocking'
|
||||
days-before-stale: 365
|
||||
days-before-close: 15
|
||||
operations-per-run: 100
|
||||
dry-run: false
|
||||
|
||||
6
.github/workflows/stale-issues.yml
vendored
6
.github/workflows/stale-issues.yml
vendored
@ -12,12 +12,12 @@ jobs:
|
||||
- uses: Dolibarr/stale@master
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. Without comment, this issue will be closed automatically by stale bot in 15 days.'
|
||||
stale-issue-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 15 days (you should still be able to re-open it if required).'
|
||||
stale-issue-label: 'Issue Stale (automatic label)'
|
||||
exempt-issue-label: 'Priority High / Blocking'
|
||||
days-before-stale: 365
|
||||
days-before-close: 15
|
||||
operations-per-run: 50
|
||||
days-before-close: -1
|
||||
operations-per-run: 100
|
||||
#stale-pr-message: 'This PR is stale because it has been open 1 year with no activity. If this PR is still mergeable (no conflict, nor Continuous Integration errors), please comment to confirm this merge is still expected. Without comment, this issue will be closed automatically by stale bot in 15 days.'
|
||||
stale-pr-label: 'PR Stale (automatic label)'
|
||||
stale-pr-message:
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -40,3 +40,4 @@ htdocs/includes/sebastian/
|
||||
htdocs/includes/squizlabs/
|
||||
htdocs/includes/symfony/
|
||||
htdocs/includes/webmozart/
|
||||
htdocs/.well-known/apple-developer-merchantid-domain-association
|
||||
|
||||
@ -37,10 +37,11 @@ TCPDF 6.3.2 LGPL-3+ Yes
|
||||
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
||||
|
||||
JS libraries:
|
||||
Ace 1.4.6 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||
Ace 1.4.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||
Chart 2.9.3 MIT License Yes JS library for graph
|
||||
jQuery 3.4.1 MIT License Yes JS library
|
||||
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
|
||||
jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect
|
||||
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect
|
||||
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
||||
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
|
||||
jQuery Flot 0.8.3 MIT License Yes JS library to build graph
|
||||
|
||||
66
ChangeLog
66
ChangeLog
@ -2,6 +2,69 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
***** ChangeLog for 11.0.2 compared to 11.0.1 *****
|
||||
FIX: #10309
|
||||
FIX: #13110
|
||||
FIX: #13118
|
||||
FIX: #13124
|
||||
FIX: #13131
|
||||
FIX: #13135
|
||||
FIX: #13146 #13198
|
||||
FIX: #13175
|
||||
FIX: #13182
|
||||
FIX: #13183
|
||||
FIX: #13184
|
||||
FIX: #13263
|
||||
FIX: #13267
|
||||
FIX: an external user can not approve
|
||||
FIX: API Get list of documents for supplier_invoice
|
||||
FIX: API to push an expense report
|
||||
FIX: API upload/download doc for expensereport
|
||||
FIX: Avoid to download the export if we just press enter to refresh form
|
||||
FIX: Bad link to template invoices
|
||||
FIX: Bad sort link in accounting report
|
||||
FIX: Bad translation for productlot EatBy and SellBy
|
||||
FIX: better method to check user rights AND usergroup rights !
|
||||
FIX: CA by product list filter
|
||||
FIX: CSS
|
||||
FIX: Disable js if no javascript
|
||||
FIX: duplicate class name into some log lines
|
||||
FIX: etrafield with visibilty=5 were not in read only.
|
||||
FIX: excess paid from situation invoices not counted when calculating remain to pay.
|
||||
FIX: Force FEC export to txt format.
|
||||
FIX: Free input for email no more visible.
|
||||
FIX: Keep assigned users in session when loading projects and tasks
|
||||
FIX: List of viewed projects too large in task widget.
|
||||
FIX: Menu truncated. Add tooltip to have all content.
|
||||
FIX: Missing field "billed" in export.
|
||||
FIX: missing "statut" for getNomUrl() function
|
||||
FIX: modFournisseur is required by modSupplierProposal
|
||||
FIX: Multicompany compatibility
|
||||
FIX: must be == and not =
|
||||
FIX: option for topbar search and bookmarks
|
||||
FIX: option MAIN_OPTIMIZEFORTEXTBROWSER
|
||||
FIX: some responsive troubles
|
||||
FIX: round MT in accountancy books
|
||||
FIX: search with '0'
|
||||
FIX: sort link
|
||||
FIX: SQL Overload in default contact trigger.
|
||||
FIX: SQl syntax error.
|
||||
FIX: Submit of documents for supplier invoices.
|
||||
FIX: timezone must be tzserver and not tzuser as on contract card
|
||||
FIX: token in barcode tools page missing
|
||||
FIX: Bad name of trigger PROPAL_SUPPLIER_TRIGGER, should be PROPOSAL_SUPPLIER_TRIGGER
|
||||
FIX: Type of contact for event does not exists and not supported
|
||||
FIX: Type of contact not saved when creating a contact
|
||||
FIX: typo on ckeck method
|
||||
FIX: undefined function measuringUnitString in product list
|
||||
FIX: Usage of project not available in export.
|
||||
FIX: wrong test
|
||||
FIX: z-index for moretabsList with constant MAIN_MAXTABS_IN_CARD
|
||||
FIX: Use GETPOST instead of POST
|
||||
FIX: HTML Injection
|
||||
FIX: Visualization rights correction on last modified contacts box.
|
||||
FIX: Vulnerability in module from modulebuilder.
|
||||
FIX: Vulnerability reported by code16
|
||||
|
||||
***** ChangeLog for 12.0.0 compared to 11.0.0 *****
|
||||
For Users:
|
||||
@ -19,7 +82,8 @@ Following changes may create regressions for some external modules, but were nec
|
||||
with HTML content that you make a GETPOST('myparam', 'restricthtml') or GETPOST('myparam', 'none') if you really need posted content without sanitizing
|
||||
the HTML into content (in such a case, sanitize data later)
|
||||
* Removed hidden constant MAIN_EXTRAFIELDS_IN_ONE_TD that was useless.
|
||||
|
||||
* Reference of object including a "/" are no more allowed. It is never used by default but to support setup that introduced it, the "/" will be replaced
|
||||
by a "_" automatically when a reference is generated.
|
||||
|
||||
***** ChangeLog for 11.0.1 compared to 11.0.0 *****
|
||||
FIX: advanced target emailing sql and ergonomy.
|
||||
|
||||
@ -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-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -54,19 +54,27 @@ $list_account_main = array (
|
||||
|
||||
$list_account = array ();
|
||||
$list_account[] = '---Product---';
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT';
|
||||
if ($mysoc->isInEEC()) {
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_ACCOUNT';
|
||||
if ($mysoc->isInEEC()) {
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT';
|
||||
$list_account[] = '---Service---';
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_BUY_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_SOLD_ACCOUNT';
|
||||
if ($mysoc->isInEEC()) {
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_BUY_ACCOUNT';
|
||||
if ($mysoc->isInEEC()) {
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT';
|
||||
$list_account[] = '---Other---';
|
||||
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2020 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>
|
||||
@ -117,7 +117,9 @@ if ($action == 'update') {
|
||||
'ACCOUNTANCY_SELL',
|
||||
'ACCOUNTANCY_SELL_INTRA',
|
||||
'ACCOUNTANCY_SELL_EXPORT',
|
||||
'ACCOUNTANCY_BUY'
|
||||
'ACCOUNTANCY_BUY',
|
||||
'ACCOUNTANCY_BUY_INTRA',
|
||||
'ACCOUNTANCY_BUY_EXPORT'
|
||||
);
|
||||
|
||||
if (in_array($accounting_product_mode, $accounting_product_modes)) {
|
||||
@ -159,6 +161,12 @@ if ($action == 'update') {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$sql .= " SET accountancy_code_buy = ".$accounting->account_number;
|
||||
}
|
||||
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;
|
||||
}
|
||||
@ -204,7 +212,11 @@ $form = new FormAccounting($db);
|
||||
$accounting = new AccountingAccount($db);
|
||||
// TODO: we should need to check if result is already exists accountaccount rowid.....
|
||||
$aarowid_servbuy = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
||||
$aarowid_servbuy_intra = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT, 1);
|
||||
$aarowid_servbuy_export = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT, 1);
|
||||
$aarowid_prodbuy = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
||||
$aarowid_prodbuy_intra = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT, 1);
|
||||
$aarowid_prodbuy_export = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT, 1);
|
||||
$aarowid_servsell = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
|
||||
$aarowid_servsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT, 1);
|
||||
$aarowid_servsell_export = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT, 1);
|
||||
@ -213,7 +225,11 @@ $aarowid_prodsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_P
|
||||
$aarowid_prodsell_export = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT, 1);
|
||||
|
||||
$aacompta_servbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy_intra = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy_export = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy_intra = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy_export = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_intra = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_export = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
@ -228,7 +244,8 @@ $pcgvercode = dol_getIdFromCode($db, $pcgverid, 'accounting_system', 'rowid', 'p
|
||||
if (empty($pcgvercode)) $pcgvercode=$pcgverid;
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.label, p.description, p.tosell, p.tobuy,";
|
||||
$sql.= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,";
|
||||
$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";
|
||||
@ -236,6 +253,14 @@ $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 = '" . $pcgvercode . "'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA')
|
||||
{
|
||||
$sql.=" p.accountancy_code_buy_intra = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT')
|
||||
{
|
||||
$sql.=" p.accountancy_code_buy_export = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL')
|
||||
{
|
||||
$sql.=" p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
@ -253,6 +278,14 @@ 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);
|
||||
@ -356,6 +389,13 @@ if ($result)
|
||||
print "</td></tr>\n";
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductBuy') . '</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_INTRA"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductBuyIntra') . '</td>';
|
||||
print '<td>' . $langs->trans('OptionModeProductBuyDesc') . "</td></tr>\n";
|
||||
}
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_EXPORT"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductBuyExport') . '</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
|
||||
print "</table>\n";
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Refresh') . '" name="changetype"></div>';
|
||||
@ -386,7 +426,7 @@ if ($result)
|
||||
print '<td class="liste_titre center">'.$form->selectyesno('search_onsell', $search_onsell, 1, false, 1).'</td>';
|
||||
}
|
||||
// On buy
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY' || $accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
print '<td class="liste_titre center">'.$form->selectyesno('search_onpurchase', $search_onpurchase, 1, false, 1).'</td>';
|
||||
}
|
||||
// Current account
|
||||
@ -416,10 +456,16 @@ if ($result)
|
||||
} 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";
|
||||
} else {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
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("AssignDedicatedAccountingAccount");
|
||||
$clickpitco=$form->showCheckAddButtons('checkforselect', 1);
|
||||
@ -457,22 +503,22 @@ if ($result)
|
||||
$compta_prodsell_id = $aarowid_prodsell_export;
|
||||
}
|
||||
else {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell;
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell;
|
||||
$compta_prodsell_id = $aarowid_servsell;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell_intra;
|
||||
$compta_prodsell_id = $aarowid_servsell_intra;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell_export;
|
||||
$compta_prodsell_id = $aarowid_servsell_export;
|
||||
}
|
||||
else {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
@ -482,11 +528,40 @@ if ($result)
|
||||
|
||||
// Purchases
|
||||
if ($obj->product_type == 0) {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy;
|
||||
} else {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy;
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy_intra;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy_export;
|
||||
}
|
||||
else {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy_intra;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy_export;
|
||||
}
|
||||
else {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy;
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
@ -509,7 +584,7 @@ if ($result)
|
||||
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')
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY' || $accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT')
|
||||
print '<td class="center">'.$product_static->getLibStatut(3, 1).'</td>';
|
||||
|
||||
// Current accounting account
|
||||
@ -517,7 +592,13 @@ if ($result)
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
print length_accountg($obj->accountancy_code_buy);
|
||||
if ($obj->accountancy_code_buy && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
print length_accountg($obj->accountancy_code_buy_intra);
|
||||
if ($obj->accountancy_code_buy_intra && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
print length_accountg($obj->accountancy_code_buy_export);
|
||||
if ($obj->accountancy_code_buy_export && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
print length_accountg($obj->accountancy_code_sell);
|
||||
if ($obj->accountancy_code_sell && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
@ -540,6 +621,26 @@ if ($result)
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
// Accounting account buy intra (In EEC)
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
if (empty($defaultvalue)) $defaultvalue=$compta_prodbuy_intra;
|
||||
$codesell=length_accountg($obj->accountancy_code_buy_intra);
|
||||
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
// Accounting account buy export (Out of EEC)
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
if (empty($defaultvalue)) $defaultvalue=$compta_prodbuy_export;
|
||||
$codesell=length_accountg($obj->accountancy_code_buy_export);
|
||||
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
// Accounting account sell
|
||||
print '<td class="left">';
|
||||
|
||||
@ -271,7 +271,7 @@ if ($action != 'export_csv')
|
||||
$sql .= " AND t.doc_date < '".$db->idate($search_date_start)."' GROUP BY t.numero_compte";
|
||||
$resql = $db->query($sql);
|
||||
$nrows = $resql->num_rows;
|
||||
$opening_balances = Array();
|
||||
$opening_balances = array();
|
||||
for ($i = 0; $i < $nrows; $i++) {
|
||||
$arr = $resql->fetch_array();
|
||||
$opening_balances["'".$arr['numero_compte']."'"] = $arr['opening_balance'];
|
||||
|
||||
@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
@ -538,6 +539,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
|
||||
*/
|
||||
|
||||
$formother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
$title_page = $langs->trans("Bookkeeping");
|
||||
|
||||
@ -914,7 +916,69 @@ while ($i < min($num, $limit))
|
||||
// Document ref
|
||||
if (!empty($arrayfields['t.doc_ref']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">'.$line->doc_ref.'</td>';
|
||||
if ($line->doc_type == 'customer_invoice')
|
||||
{
|
||||
$langs->loadLangs(array('bills'));
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$objectstatic = new Facture($db);
|
||||
$objectstatic->fetch($line->fk_doc);
|
||||
//$modulepart = 'facture';
|
||||
|
||||
$filename = dol_sanitizeFileName($line->doc_ref);
|
||||
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
|
||||
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
|
||||
}
|
||||
elseif ($line->doc_type == 'supplier_invoice')
|
||||
{
|
||||
$langs->loadLangs(array('bills'));
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
$objectstatic = new FactureFournisseur($db);
|
||||
$objectstatic->fetch($line->fk_doc);
|
||||
//$modulepart = 'invoice_supplier';
|
||||
|
||||
$filename = dol_sanitizeFileName($line->doc_ref);
|
||||
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
|
||||
$subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
|
||||
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
|
||||
}
|
||||
elseif ($line->doc_type == 'expense_report')
|
||||
{
|
||||
$langs->loadLangs(array('trips'));
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
$objectstatic = new ExpenseReport($db);
|
||||
$objectstatic->fetch($line->fk_doc);
|
||||
//$modulepart = 'expensereport';
|
||||
|
||||
$filename=dol_sanitizeFileName($line->doc_ref);
|
||||
$filedir=$conf->expensereport->dir_output . '/' . dol_sanitizeFileName($line->doc_ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
|
||||
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Other type
|
||||
}
|
||||
|
||||
print '<td class="nowrap">';
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
// Picto + Ref
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
|
||||
if($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report')
|
||||
{
|
||||
print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
|
||||
print $documentlink;
|
||||
} else {
|
||||
print $line->doc_ref;
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ if ($conf->accounting->enabled)
|
||||
|
||||
$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
|
||||
|
||||
$helpisexpanded = empty($resultboxes['boxactivated']); // If there is no widget, the tooltip help is expanded by default.
|
||||
$helpisexpanded = empty($resultboxes['boxactivated']) || (empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])); // If there is no widget, the tooltip help is expanded by default.
|
||||
$showtutorial = '';
|
||||
|
||||
if (!$helpisexpanded)
|
||||
@ -222,10 +222,6 @@ if ($conf->accounting->enabled)
|
||||
$boxlist .= '<div class="twocolumns">';
|
||||
|
||||
$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
|
||||
if (!empty($nbworkboardcount))
|
||||
{
|
||||
$boxlist .= $boxwork;
|
||||
}
|
||||
|
||||
$boxlist .= $resultboxes['boxlista'];
|
||||
|
||||
@ -233,7 +229,6 @@ if ($conf->accounting->enabled)
|
||||
|
||||
$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
|
||||
|
||||
$boxlist .= $boxstat;
|
||||
$boxlist .= $resultboxes['boxlistb'];
|
||||
|
||||
$boxlist .= '</div>';
|
||||
|
||||
@ -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-2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -119,8 +119,9 @@ if ($action == 'validatehistory') {
|
||||
// Supplier Invoice Lines (must be same request than into page list.php for manual binding)
|
||||
$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.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
||||
$sql .= " aa.rowid as aarowid,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type,";
|
||||
$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, p.tva_tx as tva_tx_prod,";
|
||||
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
|
||||
$sql .= " co.code as country_code, co.label as country_label,";
|
||||
$sql .= " s.tva_intra";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
@ -128,7 +129,9 @@ if ($action == 'validatehistory') {
|
||||
$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 = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
|
||||
$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 = '".$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 = '".$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 = '".$chartaccountcode."' AND aa3.entity = ".$conf->entity;
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
|
||||
@ -157,16 +160,12 @@ if ($action == 'validatehistory') {
|
||||
$suggestedaccountingaccountfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
//$objp->code_buy_p = $objp->code_buy_intra;
|
||||
$objp->code_buy_p = $objp->code_buy;
|
||||
//$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$objp->code_buy_p = $objp->code_buy_intra;
|
||||
$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||
$suggestedaccountingaccountfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
//$objp->code_buy_p = $objp->code_buy_export;
|
||||
$objp->code_buy_p = $objp->code_buy;
|
||||
//$objp->aarowid_suggest = $objp->aarowid_export;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$objp->code_buy_p = $objp->code_buy_export;
|
||||
$objp->aarowid_suggest = $objp->aarowid_export;
|
||||
$suggestedaccountingaccountfor = 'export';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
|
||||
@ -211,7 +211,8 @@ 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.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
||||
$sql .= " aa.rowid as aarowid,";
|
||||
$sql .= " p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
|
||||
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
|
||||
$sql .= " co.code as country_code, co.label as country_label,";
|
||||
$sql .= " s.tva_intra";
|
||||
$parameters = array();
|
||||
@ -222,7 +223,9 @@ $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."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 = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
|
||||
$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 = '".$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 = '".$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 = '".$chartaccountcode."' AND aa3.entity = ".$conf->entity;
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
// Add search filter like
|
||||
@ -414,7 +417,6 @@ if ($result) {
|
||||
// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
|
||||
$objp->code_buy_l = '';
|
||||
$objp->code_buy_p = '';
|
||||
$objp->aarowid_suggest = '';
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
@ -426,28 +428,67 @@ if ($result) {
|
||||
$facturefourn_static->type = $objp->type;
|
||||
|
||||
$code_buy_p_notset = '';
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$objp->aarowid_suggest = ''; // Will be set later
|
||||
|
||||
$isBuyerInEEC = isInEEC($objp);
|
||||
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
if ($objp->type_l == 1) {
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : '');
|
||||
if ($objp->aarowid == '')
|
||||
$objp->aarowid_suggest = $aarowid_s;
|
||||
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'export';
|
||||
}
|
||||
}
|
||||
} elseif ($objp->type_l == 0) {
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : '');
|
||||
if ($objp->aarowid == '')
|
||||
$objp->aarowid_suggest = $aarowid_p;
|
||||
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else {
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'export';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($objp->code_buy_l == -1) $objp->code_buy_l = '';
|
||||
if ($objp->code_sell_l == -1) $objp->code_sell_l = '';
|
||||
|
||||
if (!empty($objp->code_buy)) {
|
||||
$objp->code_buy_p = $objp->code_buy; // Code on product
|
||||
// Search suggested account for product/service
|
||||
$suggestedaccountingaccountfor = '';
|
||||
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_buy_p = $objp->code_buy;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$suggestedaccountingaccountfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_p = $objp->code_buy_intra;
|
||||
$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||
$suggestedaccountingaccountfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
$objp->code_buy_p = $objp->code_buy_export;
|
||||
$objp->aarowid_suggest = $objp->aarowid_export;
|
||||
$suggestedaccountingaccountfor = 'export';
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($objp->code_buy_p)) {
|
||||
// Value was defined previously
|
||||
} else {
|
||||
$code_buy_p_notset = 'color:orange';
|
||||
}
|
||||
if (empty($objp->code_buy_l) && empty($objp->code_buy_p)) $code_buy_p_notset = 'color:red';
|
||||
|
||||
// $objp->code_buy_p is now code of product/service
|
||||
// $objp->code_buy_l is now default code of product/service
|
||||
// $objp->code_buy_p is now code of product/service
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -520,6 +561,21 @@ if ($result) {
|
||||
// Suggested accounting account
|
||||
print '<td>';
|
||||
$suggestedid = $objp->aarowid_suggest;
|
||||
if (empty($suggestedid) && empty($objp->code_buy_p) && ! empty($objp->code_buy_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC))
|
||||
{
|
||||
if (empty($accountingaccount_codetotid_cache[$objp->code_buy_l]))
|
||||
{
|
||||
$tmpaccount = new AccountingAccount($db);
|
||||
$tmpaccount->fetch(0, $objp->code_buy_l, 1);
|
||||
if ($tmpaccount->id > 0) {
|
||||
$suggestedid = $tmpaccount->id;
|
||||
}
|
||||
$accountingaccount_codetotid_cache[$objp->code_buy_l] = $tmpaccount->id;
|
||||
}
|
||||
else {
|
||||
$suggestedid = $accountingaccount_codetotid_cache[$objp->code_buy_l];
|
||||
}
|
||||
}
|
||||
print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print '</td>';
|
||||
|
||||
@ -540,6 +596,9 @@ if ($result) {
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
if ($db->type == 'mysqli') {
|
||||
$db->query("SET SQL_BIG_SELECTS=0"); // Enable MAX_JOIN_SIZE limitation
|
||||
}
|
||||
|
||||
// Add code to auto check the box when we select an account
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
|
||||
@ -1356,7 +1356,7 @@ class Adherent extends CommonObject
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/adherents/class/subscription.class.php';
|
||||
|
||||
$sql = "SELECT c.rowid, c.fk_adherent, c.subscription, c.note, c.fk_bank,";
|
||||
$sql = "SELECT c.rowid, c.fk_adherent, c.fk_type, c.subscription, c.note, c.fk_bank,";
|
||||
$sql .= " c.tms as datem,";
|
||||
$sql .= " c.datec as datec,";
|
||||
$sql .= " c.dateadh as dateh,";
|
||||
@ -1386,6 +1386,7 @@ class Adherent extends CommonObject
|
||||
$subscription = new Subscription($this->db);
|
||||
$subscription->id = $obj->rowid;
|
||||
$subscription->fk_adherent = $obj->fk_adherent;
|
||||
$subscription->fk_type = $obj->fk_type;
|
||||
$subscription->amount = $obj->subscription;
|
||||
$subscription->note = $obj->note;
|
||||
$subscription->fk_bank = $obj->fk_bank;
|
||||
|
||||
@ -176,11 +176,9 @@ if ($conf->use_javascript_ajax)
|
||||
$SommeD = 0;
|
||||
$total = 0;
|
||||
$dataval = array();
|
||||
$datalabels = array();
|
||||
$i = 0;
|
||||
foreach ($AdherentType as $key => $adhtype)
|
||||
{
|
||||
$datalabels[] = array($i, $adhtype->getNomUrl(0, dol_size(16)));
|
||||
$dataval['draft'][] = array($i, isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0);
|
||||
$dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0);
|
||||
$dataval['uptodate'][] = array($i, isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0);
|
||||
@ -198,13 +196,16 @@ if ($conf->use_javascript_ajax)
|
||||
$dataseries[] = array($langs->trans("MembersStatusResiliated"), round($SommeD));
|
||||
$dataseries[] = array($langs->trans("MembersStatusToValid"), round($SommeA));
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->SetDataColor(array($badgeStatus1, $badgeStatus4, $badgeStatus6, '-'.$badgeStatus0));
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setWidth('100%');
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphstatus');
|
||||
print $dolgraph->show($total ? 0 : 1);
|
||||
|
||||
|
||||
@ -767,7 +767,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
|
||||
if ($keycode == 'sortorder') // For column name 'sortorder', we use the field name 'position'
|
||||
{
|
||||
$sql .= "'".(int) GETPOST('position', 'int');
|
||||
$sql .= "'".(int) GETPOST('position', 'int')."'";
|
||||
}
|
||||
elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = ''
|
||||
elseif ($keycode == 'content') {
|
||||
|
||||
@ -156,7 +156,6 @@ if ($action == 'update')
|
||||
dolibarr_set_const($db, "MAIN_START_WEEK", GETPOST("MAIN_START_WEEK", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
//dolibarr_set_const($db, "MAIN_SHOW_LOGO", GETPOST("MAIN_SHOW_LOGO", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", GETPOST('MAIN_HELPCENTER_DISABLELINK', 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
|
||||
|
||||
@ -197,6 +197,7 @@ dol_fiche_end();
|
||||
|
||||
print load_fiche_titre($langs->trans("TicketNumberingModules"));
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="100">'.$langs->trans("Name").'</td>';
|
||||
@ -287,7 +288,9 @@ foreach ($dirmodels as $reldir) {
|
||||
}
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
if (!$conf->use_javascript_ajax) {
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||
|
||||
@ -167,7 +167,7 @@ $head = ticketAdminPrepareHead();
|
||||
|
||||
dol_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket");
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> : <a href="'.dol_buildpath('/public/ticket/index.php', 1).'" target="_blank" >'.dol_buildpath('/public/ticket/index.php', 2).'</a>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> : <a class="wordbreak" href="'.dol_buildpath('/public/ticket/index.php', 1).'" target="_blank" >'.dol_buildpath('/public/ticket/index.php', 2).'</a>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -176,14 +176,14 @@ $enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' ';
|
||||
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
|
||||
{
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=1'.$param.'">';
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=1'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$enabledisablehtml .= '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=0'.$param.'">';
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=0'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$enabledisablehtml .= '</a>';
|
||||
}
|
||||
@ -200,6 +200,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
|
||||
print '<input type="hidden" name="action" value="setvarother">';
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td>';
|
||||
print '<td class="left">';
|
||||
@ -279,7 +280,9 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
if (!$conf->use_javascript_ajax) {
|
||||
print '</form>';
|
||||
@ -288,6 +291,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
|
||||
// Admin var of module
|
||||
print load_fiche_titre($langs->trans("TicketParamMail"));
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||
@ -369,13 +373,14 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
|
||||
$url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
|
||||
print '<tr><td>'.$langs->trans("TicketUrlPublicInterfaceLabelAdmin").'</label>';
|
||||
print '</td><td>';
|
||||
print '<input type="text" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$conf->global->TICKET_URL_PUBLIC_INTERFACE.'" size="40" ></td>';
|
||||
print '<input type="text" class="minwidth500" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$conf->global->TICKET_URL_PUBLIC_INTERFACE.'"></td>';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
|
||||
|
||||
|
||||
@ -561,7 +561,7 @@ class BOM extends CommonObject
|
||||
{
|
||||
$num = $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
// Validate
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
|
||||
@ -32,6 +32,7 @@ function printDropdownBookmarksList()
|
||||
global $conf, $user, $db, $langs;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
|
||||
$langs->load("bookmarks");
|
||||
|
||||
@ -60,6 +61,7 @@ function printDropdownBookmarksList()
|
||||
|
||||
$searchForm = '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
|
||||
$searchForm .= '<form id="top-menu-action-bookmark" name="actionbookmark" method="POST" action="" onsubmit="return false" >';
|
||||
$searchForm .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$searchForm .= '<input name="bookmark" id="top-bookmark-search-input" class="dropdown-search-input" placeholder="'.$langs->trans('Bookmarks').'" autocomplete="off" >';
|
||||
$searchForm .= '</form>';
|
||||
|
||||
|
||||
@ -1958,4 +1958,56 @@ class Categorie extends CommonObject
|
||||
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the addtional SQL JOIN query for filtering a list by a category
|
||||
*
|
||||
* @param string $type The category type (e.g Categorie::TYPE_WAREHOUSE)
|
||||
* @param string $rowIdName The name of the row id inside the whole sql query (e.g. "e.rowid")
|
||||
* @return string A additional SQL JOIN query
|
||||
*/
|
||||
public static function getFilterJoinQuery($type, $rowIdName)
|
||||
{
|
||||
return " LEFT JOIN ".MAIN_DB_PREFIX."categorie_".$type." as cp"
|
||||
. " ON ".$rowIdName." = cp.fk_".$type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the addtional SQL SELECT query for filtering a list by a category
|
||||
*
|
||||
* @param string $type The category type (e.g Categorie::TYPE_WAREHOUSE)
|
||||
* @param string $rowIdName The name of the row id inside the whole sql query (e.g. "e.rowid")
|
||||
* @param Array $searchList A list with the selected categories
|
||||
* @return string A additional SQL SELECT query
|
||||
*/
|
||||
public static function getFilterSelectQuery($type, $rowIdName, $searchList)
|
||||
{
|
||||
if (empty($searchList) && !is_array($searchList))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
foreach ($searchList as $searchCategory)
|
||||
{
|
||||
if (intval($searchCategory) == -2)
|
||||
{
|
||||
$searchCategorySqlList[] = " cp.fk_categorie IS NULL";
|
||||
}
|
||||
elseif (intval($searchCategory) > 0)
|
||||
{
|
||||
$searchCategorySqlList[] = " ".$rowIdName
|
||||
." IN (SELECT fk_".$type." FROM ".MAIN_DB_PREFIX."categorie_".$type
|
||||
." WHERE fk_categorie = ".$searchCategory.")";
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($searchCategorySqlList))
|
||||
{
|
||||
return " AND (".implode(' AND ', $searchCategorySqlList).")";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2020 Thibault FOUCART <support@ptibogxiv.net>
|
||||
*
|
||||
* 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
|
||||
@ -64,11 +65,65 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function get($id, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch($id, '', '', $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties of an proposal object by ref
|
||||
*
|
||||
* Return an array with proposal informations
|
||||
*
|
||||
* @param string $ref Ref of object
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @url GET ref/{ref}
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getByRef($ref, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch('', $ref, '', $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties of an proposal object by ref_ext
|
||||
*
|
||||
* Return an array with proposal informations
|
||||
*
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @url GET ref_ext/{ref_ext}
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getByRefExt($ref_ext, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch('', '', $ref_ext, $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties of an proposal object
|
||||
*
|
||||
* Return an array with proposal informations
|
||||
*
|
||||
* @param int $id ID of order
|
||||
* @param string $ref Ref of object
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
$result = $this->propal->fetch($id, $ref, $ref_ext);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
@ -223,6 +223,90 @@ class Propal extends CommonObject
|
||||
|
||||
public $oldcopy;
|
||||
|
||||
|
||||
/**
|
||||
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', '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.
|
||||
* 'enabled' is a condition when the field must be managed.
|
||||
* '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' is the CSS style to use on field. For example: 'maxwidth200'
|
||||
* 'help' is a string visible as a tooltip on field
|
||||
* '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")
|
||||
* '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.
|
||||
*/
|
||||
|
||||
// BEGIN MODULEBUILDER PROPERTIES
|
||||
/**
|
||||
* @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),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>15, 'index'=>1),
|
||||
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20),
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40),
|
||||
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>45), // deprecated
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>23),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>24),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'datep' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||
'fin_validite' =>array('type'=>'datetime', 'label'=>'DateEnd', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>70),
|
||||
'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>85),
|
||||
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user cloture', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
'price' =>array('type'=>'double', 'label'=>'Price', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
|
||||
'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
|
||||
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
|
||||
'tva' =>array('type'=>'double(24,8)', 'label'=>'VAT', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1),
|
||||
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
|
||||
'total' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
|
||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Currency', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>175),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>180),
|
||||
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||
'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>0, 'position'=>200), // deprecated
|
||||
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
|
||||
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>220),
|
||||
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLabel', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>225),
|
||||
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'MulticurrencyID', 'enabled'=>1, 'visible'=>-1, 'position'=>230),
|
||||
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'MulticurrencyCurrency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>235),
|
||||
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>240, 'isameasure'=>1),
|
||||
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>245, 'isameasure'=>1),
|
||||
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>250, 'isameasure'=>1),
|
||||
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>255, 'isameasure'=>1),
|
||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>260),
|
||||
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
|
||||
);
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
/**
|
||||
* Draft status
|
||||
*/
|
||||
@ -1377,9 +1461,10 @@ class Propal extends CommonObject
|
||||
*
|
||||
* @param int $rowid id of object to load
|
||||
* @param string $ref Ref of proposal
|
||||
* @param string $ref_ext Ref ext of proposal
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
public function fetch($rowid, $ref = '')
|
||||
public function fetch($rowid, $ref = '', $ref_ext = '')
|
||||
{
|
||||
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
|
||||
$sql .= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht";
|
||||
@ -1811,7 +1896,7 @@ class Propal extends CommonObject
|
||||
{
|
||||
$num = $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
||||
$sql .= " SET ref = '".$this->db->escape($num)."',";
|
||||
|
||||
@ -210,10 +210,11 @@ class PropaleStats extends Stats
|
||||
/**
|
||||
* Return nb, amount of predefined product for year
|
||||
*
|
||||
* @param int $year Year to scan
|
||||
* @return array Array of values
|
||||
* @param int $year Year to scan
|
||||
* @param int $limit Limit
|
||||
* @return array Array of values
|
||||
*/
|
||||
public function getAllByProduct($year)
|
||||
public function getAllByProduct($year, $limit = 10)
|
||||
{
|
||||
global $user;
|
||||
|
||||
@ -227,6 +228,6 @@ class PropaleStats extends Stats
|
||||
$sql.= $this->db->order('nb', 'DESC');
|
||||
//$sql.= $this->db->plimit(20);
|
||||
|
||||
return $this->_getAllByProduct($sql);
|
||||
return $this->_getAllByProduct($sql, $limit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
/**
|
||||
* \file htdocs/comm/propal/contact.php
|
||||
* \ingroup propal
|
||||
* \brief Onglet de gestion des contacts de propal
|
||||
* \brief Tab to manage contacts/adresses of proposal
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -141,10 +141,10 @@ if ($resql)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setWidth('100%');
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphthirdparties');
|
||||
print $dolgraph->show($total ? 0 : 1);
|
||||
|
||||
|
||||
@ -69,6 +69,11 @@ $search_societe = GETPOST('search_societe', 'alpha');
|
||||
$search_montant_ht = GETPOST('search_montant_ht', 'alpha');
|
||||
$search_montant_vat = GETPOST('search_montant_vat', 'alpha');
|
||||
$search_montant_ttc = GETPOST('search_montant_ttc', 'alpha');
|
||||
$search_multicurrency_code = GETPOST('search_multicurrency_code', 'alpha');
|
||||
$search_multicurrency_tx = GETPOST('search_multicurrency_tx', 'alpha');
|
||||
$search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'alpha');
|
||||
$search_multicurrency_montant_vat = GETPOST('search_multicurrency_montant_vat', 'alpha');
|
||||
$search_multicurrency_montant_ttc = GETPOST('search_multicurrency_montant_ttc', 'alpha');
|
||||
$search_login = GETPOST('search_login', 'alpha');
|
||||
$search_product_category = GETPOST('search_product_category', 'int');
|
||||
$search_town = GETPOST('search_town', 'alpha');
|
||||
@ -162,8 +167,15 @@ $arrayfields = array(
|
||||
'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
|
||||
'p.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
|
||||
'p.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
|
||||
'p.total_ht_invoiced'=>array('label'=>"AmountInvoicedHT", 'checked'=>0, 'enabled'=>$conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT),
|
||||
'p.total_invoiced'=>array('label'=>"AmountInvoicedTTC", 'checked'=>0, 'enabled'=>$conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT),
|
||||
'p.total_ht_invoiced'=>array('label'=>"AmountInvoicedHT", 'checked'=>0, 'enabled'=>! empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'p.total_invoiced'=>array('label'=>"AmountInvoicedTTC", 'checked'=>0, 'enabled'=>! empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'p.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'p.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'p.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'p.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'p.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'p.multicurrency_total_ht_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedHT', 'checked'=>0, 'enabled'=>! empty($conf->multicurrency->enabled) && ! empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'p.multicurrency_total_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedTTC', 'checked'=>0, 'enabled'=>! empty($conf->multicurrency->enabled) && ! empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10),
|
||||
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1),
|
||||
'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||
@ -209,6 +221,11 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_montant_ht = '';
|
||||
$search_montant_vat = '';
|
||||
$search_montant_ttc = '';
|
||||
$search_multicurrency_code = '';
|
||||
$search_multicurrency_tx = '';
|
||||
$search_multicurrency_montant_ht = '';
|
||||
$search_multicurrency_montant_vat = '';
|
||||
$search_multicurrency_montant_ttc = '';
|
||||
$search_login = '';
|
||||
$search_product_category = '';
|
||||
$search_town = '';
|
||||
@ -269,6 +286,7 @@ $sql .= " typent.code as typent_code,";
|
||||
$sql .= " ava.rowid as availability,";
|
||||
$sql .= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql .= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,';
|
||||
$sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva as multicurrency_total_vat, p.multicurrency_total_ttc,';
|
||||
$sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
|
||||
$sql .= ' p.note_public, p.note_private,';
|
||||
$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
|
||||
@ -326,6 +344,11 @@ if ($search_login) $sql .= natural_search("u.login", $search_login);
|
||||
if ($search_montant_ht != '') $sql .= natural_search("p.total_ht", $search_montant_ht, 1);
|
||||
if ($search_montant_vat != '') $sql .= natural_search("p.tva", $search_montant_vat, 1);
|
||||
if ($search_montant_ttc != '') $sql .= natural_search("p.total", $search_montant_ttc, 1);
|
||||
if ($search_multicurrency_code != '') $sql .= ' AND p.multicurrency_code = "' . $db->escape($search_multicurrency_code) . '"';
|
||||
if ($search_multicurrency_tx != '') $sql .= natural_search('p.multicurrency_tx', $search_multicurrency_tx, 1);
|
||||
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('p.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
|
||||
if ($search_multicurrency_montant_vat != '') $sql .= natural_search('p.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
|
||||
if ($search_multicurrency_montant_ttc != '') $sql .= natural_search('p.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
}
|
||||
@ -428,6 +451,11 @@ if ($resql)
|
||||
if ($search_user > 0) $param .= '&search_user='.urlencode($search_user);
|
||||
if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale);
|
||||
if ($search_montant_ht) $param .= '&search_montant_ht='.urlencode($search_montant_ht);
|
||||
if ($search_multicurrency_code != '') $param .= '&search_multicurrency_code='.urlencode($search_multicurrency_code);
|
||||
if ($search_multicurrency_tx != '') $param .= '&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
|
||||
if ($search_multicurrency_montant_ht != '') $param .= '&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
|
||||
if ($search_multicurrency_montant_vat != '') $param .= '&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
|
||||
if ($search_multicurrency_montant_ttc != '') $param .= '&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
|
||||
if ($search_login) $param .= '&search_login='.urlencode($search_login);
|
||||
if ($search_town) $param .= '&search_town='.urlencode($search_town);
|
||||
if ($search_zip) $param .= '&search_zip='.urlencode($search_zip);
|
||||
@ -677,6 +705,53 @@ if ($resql)
|
||||
print '<td class="liste_titre right">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['p.multicurrency_code']['checked']))
|
||||
{
|
||||
// Currency
|
||||
print '<td class="liste_titre">';
|
||||
print $form->selectMultiCurrency($search_multicurrency_code, 'search_multicurrency_code', 1);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['p.multicurrency_tx']['checked']))
|
||||
{
|
||||
// Currency rate
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['p.multicurrency_total_ht']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['p.multicurrency_total_vat']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['p.multicurrency_total_ttc']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked']))
|
||||
{
|
||||
// Amount invoiced
|
||||
print '<td class="liste_titre right">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked']))
|
||||
{
|
||||
// Amount invoiced
|
||||
print '<td class="liste_titre right">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['u.login']['checked']))
|
||||
{
|
||||
// Author
|
||||
@ -750,6 +825,13 @@ if ($resql)
|
||||
if (!empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.multicurrency_code']['checked'])) print_liste_field_titre($arrayfields['p.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_code', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.multicurrency_tx']['checked'])) print_liste_field_titre($arrayfields['p.multicurrency_tx']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_tx', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) print_liste_field_titre($arrayfields['p.multicurrency_total_ht']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_ht', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.multicurrency_total_vat']['checked'])) print_liste_field_titre($arrayfields['p.multicurrency_total_vat']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_tva', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_ttc', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.multicurrency_total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.multicurrency_total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder);
|
||||
// Extra fields
|
||||
@ -790,6 +872,29 @@ if ($resql)
|
||||
$projectstatic->ref = $obj->project_ref;
|
||||
$projectstatic->title = $obj->project_label;
|
||||
|
||||
$totalInvoicedHT = 0;
|
||||
$totalInvoicedTTC = 0;
|
||||
$multicurrency_totalInvoicedHT = 0;
|
||||
$multicurrency_totalInvoicedTTC = 0;
|
||||
|
||||
$TInvoiceData = $objectstatic->InvoiceArrayList($obj->rowid);
|
||||
|
||||
if (!empty($TInvoiceData))
|
||||
{
|
||||
foreach ($TInvoiceData as $invoiceData)
|
||||
{
|
||||
$invoice = new Facture($db);
|
||||
$invoice->fetch($invoiceData->facid);
|
||||
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $invoice->type == Facture::TYPE_DEPOSIT) continue;
|
||||
|
||||
$totalInvoicedHT += $invoice->total_ht;
|
||||
$totalInvoicedTTC += $invoice->total_ttc;
|
||||
$multicurrency_totalInvoicedHT += $invoice->multicurrency_total_ht;
|
||||
$multicurrency_totalInvoicedTTC += $invoice->multicurrency_total_ttc;
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (!empty($arrayfields['p.ref']['checked']))
|
||||
@ -975,46 +1080,66 @@ if ($resql)
|
||||
$totalarray['val']['p.total_ttc'] += $obj->total_ttc;
|
||||
}
|
||||
// Amount invoiced
|
||||
if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) {
|
||||
$totalInvoiced = 0;
|
||||
$p = new Propal($db);
|
||||
$TInvoiceData = $p->InvoiceArrayList($obj->rowid);
|
||||
|
||||
if (!empty($TInvoiceData)) {
|
||||
foreach ($TInvoiceData as $invoiceData) {
|
||||
$invoice = new Facture($db);
|
||||
$invoice->fetch($invoiceData->facid);
|
||||
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $invoice->type == Facture::TYPE_DEPOSIT) continue;
|
||||
$totalInvoiced += $invoice->total_ht;
|
||||
}
|
||||
}
|
||||
|
||||
print '<td class="nowrap right">'.price($totalInvoiced)."</td>\n";
|
||||
if (!empty($arrayfields['p.total_ht_invoiced']['checked']))
|
||||
{
|
||||
print '<td class="nowrap right">'.price($totalInvoicedHT)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht_invoiced';
|
||||
$totalarray['val']['p.total_ht_invoiced'] += $obj->total_ht_invoiced;
|
||||
$totalarray['val']['p.total_ht_invoiced'] += $totalInvoicedHT;
|
||||
}
|
||||
// Amount invoiced
|
||||
if (!empty($arrayfields['p.total_invoiced']['checked'])) {
|
||||
$totalInvoiced = 0;
|
||||
$p = new Propal($db);
|
||||
$TInvoiceData = $p->InvoiceArrayList($obj->rowid);
|
||||
|
||||
if (!empty($TInvoiceData)) {
|
||||
foreach ($TInvoiceData as $invoiceData) {
|
||||
$invoice = new Facture($db);
|
||||
$invoice->fetch($invoiceData->facid);
|
||||
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $invoice->type == Facture::TYPE_DEPOSIT) continue;
|
||||
$totalInvoiced += $invoice->total_ttc;
|
||||
}
|
||||
}
|
||||
|
||||
print '<td class="nowrap right">'.price($totalInvoiced)."</td>\n";
|
||||
if (!empty($arrayfields['p.total_invoiced']['checked']))
|
||||
{
|
||||
print '<td class="nowrap right">'.price($totalInvoicedTTC)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_invoiced';
|
||||
$totalarray['val']['p.total_invoiced'] += $obj->total_invoiced;
|
||||
$totalarray['val']['p.total_invoiced'] += $totalInvoicedTTC;
|
||||
}
|
||||
|
||||
// Currency
|
||||
if (!empty($arrayfields['p.multicurrency_code']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code . ' - ' . $langs->trans('Currency' . $obj->multicurrency_code)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Currency rate
|
||||
if (!empty($arrayfields['p.multicurrency_tx']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Amount HT
|
||||
if (!empty($arrayfields['p.multicurrency_total_ht']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.price($obj->multicurrency_total_ht)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Amount VAT
|
||||
if (!empty($arrayfields['p.multicurrency_total_vat']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.price($obj->multicurrency_total_vat)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Amount TTC
|
||||
if (!empty($arrayfields['p.multicurrency_total_ttc']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.price($obj->multicurrency_total_ttc)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Amount invoiced
|
||||
if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked']))
|
||||
{
|
||||
print '<td class="nowrap right">'.price($multicurrency_totalInvoicedHT)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Amount invoiced
|
||||
if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked']))
|
||||
{
|
||||
print '<td class="nowrap right">'.price($multicurrency_totalInvoicedTTC)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
$userstatic->id = $obj->fk_user_author;
|
||||
@ -1040,9 +1165,7 @@ if ($resql)
|
||||
$nbofsalesrepresentative = count($listsalesrepresentatives);
|
||||
if ($nbofsalesrepresentative > 3) // We print only number
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$companystatic->id.'">';
|
||||
print $nbofsalesrepresentative;
|
||||
print '</a>';
|
||||
}
|
||||
elseif ($nbofsalesrepresentative > 0)
|
||||
{
|
||||
|
||||
@ -64,7 +64,7 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function get($id, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch($id, '', '', '', $contact_list);
|
||||
return $this->_fetch($id, '', '', $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,7 +82,7 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function getByRef($ref, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch('', $ref, '', '', $contact_list);
|
||||
return $this->_fetch('', $ref, '', $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,7 +100,7 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function getByRefExt($ref_ext, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch('', '', $ref_ext, '', $contact_list);
|
||||
return $this->_fetch('', '', $ref_ext, $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,19 +111,18 @@ class Orders extends DolibarrApi
|
||||
* @param int $id ID of order
|
||||
* @param string $ref Ref of object
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param string $ref_int Internal reference of other objec
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $ref_int = '', $contact_list = 1)
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id, $ref, $ref_ext, $ref_int);
|
||||
$result = $this->commande->fetch($id, $ref, $ref_ext);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
@ -101,6 +101,7 @@ class Commande extends CommonOrder
|
||||
|
||||
/**
|
||||
* @var string Internal ref for order
|
||||
* @deprecated
|
||||
*/
|
||||
public $ref_int;
|
||||
|
||||
@ -232,6 +233,94 @@ class Commande extends CommonOrder
|
||||
//! key of pos source ('0', '1', ...)
|
||||
public $pos_source;
|
||||
|
||||
|
||||
/**
|
||||
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', '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.
|
||||
* 'enabled' is a condition when the field must be managed.
|
||||
* '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' is the CSS style to use on field. For example: 'maxwidth200'
|
||||
* 'help' is a string visible as a tooltip on field
|
||||
* '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")
|
||||
* '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.
|
||||
*/
|
||||
|
||||
// BEGIN MODULEBUILDER PROPERTIES
|
||||
/**
|
||||
* @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),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
|
||||
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>25),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>26),
|
||||
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>27), // deprecated
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
|
||||
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>56),
|
||||
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||
'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>70),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>80),
|
||||
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'source' =>array('type'=>'smallint(6)', 'label'=>'Source', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
//'amount_ht' =>array('type'=>'double(24,8)', 'label'=>'AmountHT', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
|
||||
'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
|
||||
'tva' =>array('type'=>'double(24,8)', 'label'=>'VAT', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
|
||||
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1),
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
|
||||
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
|
||||
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>150),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>155),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160),
|
||||
//'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'MulticurrencyID', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>200),
|
||||
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
|
||||
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>210),
|
||||
//'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>225),
|
||||
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>230),
|
||||
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLabel', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>235),
|
||||
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>240),
|
||||
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'MulticurrencyCurrency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>245),
|
||||
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>250, 'isameasure'=>1),
|
||||
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>255, 'isameasure'=>1),
|
||||
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>260, 'isameasure'=>1),
|
||||
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>265, 'isameasure'=>1),
|
||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>270),
|
||||
'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>275),
|
||||
'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>280),
|
||||
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
|
||||
);
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
/**
|
||||
* ERR Not enough stock
|
||||
*/
|
||||
@ -384,7 +473,7 @@ class Commande extends CommonOrder
|
||||
{
|
||||
$num = $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
// Validate
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
||||
@ -1693,13 +1782,13 @@ class Commande extends CommonOrder
|
||||
* @param int $id Id of object to load
|
||||
* @param string $ref Ref of object
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param string $ref_int Internal reference of other object
|
||||
* @param string $notused Internal reference of other object
|
||||
* @return int >0 if OK, <0 if KO, 0 if not found
|
||||
*/
|
||||
public function fetch($id, $ref = '', $ref_ext = '', $ref_int = '')
|
||||
public function fetch($id, $ref = '', $ref_ext = '', $notused = '')
|
||||
{
|
||||
// Check parameters
|
||||
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
|
||||
if (empty($id) && empty($ref) && empty($ref_ext)) return -1;
|
||||
|
||||
$sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut';
|
||||
$sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
|
||||
@ -1730,7 +1819,7 @@ class Commande extends CommonOrder
|
||||
|
||||
if ($ref) $sql .= " AND c.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql .= " AND c.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql .= " AND c.ref_int='".$this->db->escape($ref_int)."'";
|
||||
if ($notused) $sql .= " AND c.ref_int='".$this->db->escape($notused)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@ -203,10 +203,11 @@ class CommandeStats extends Stats
|
||||
/**
|
||||
* Return nb, amount of predefined product for year
|
||||
*
|
||||
* @param int $year Year to scan
|
||||
* @return array Array of values
|
||||
* @param int $year Year to scan
|
||||
* @param int $limit Limit
|
||||
* @return array Array of values
|
||||
*/
|
||||
public function getAllByProduct($year)
|
||||
public function getAllByProduct($year, $limit = 10)
|
||||
{
|
||||
global $user;
|
||||
|
||||
@ -220,6 +221,6 @@ class CommandeStats extends Stats
|
||||
$sql.= $this->db->order('nb', 'DESC');
|
||||
//$sql.= $this->db->plimit(20);
|
||||
|
||||
return $this->_getAllByProduct($sql);
|
||||
return $this->_getAllByProduct($sql, $limit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,10 +140,10 @@ if ($resql)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setWidth('100%');
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphstatus');
|
||||
print $dolgraph->show($total ? 0 : 1);
|
||||
|
||||
|
||||
@ -74,7 +74,13 @@ $socid = GETPOST('socid', 'int');
|
||||
$search_user = GETPOST('search_user', 'int');
|
||||
$search_sale = GETPOST('search_sale', 'int');
|
||||
$search_total_ht = GETPOST('search_total_ht', 'alpha');
|
||||
$search_total_vat = GETPOST('search_total_vat', 'alpha');
|
||||
$search_total_ttc = GETPOST('search_total_ttc', 'alpha');
|
||||
$search_multicurrency_code = GETPOST('search_multicurrency_code', 'alpha');
|
||||
$search_multicurrency_tx = GETPOST('search_multicurrency_tx', 'alpha');
|
||||
$search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'alpha');
|
||||
$search_multicurrency_montant_vat = GETPOST('search_multicurrency_montant_vat', 'alpha');
|
||||
$search_multicurrency_montant_ttc = GETPOST('search_multicurrency_montant_ttc', 'alpha');
|
||||
$search_login = GETPOST('search_login', 'alpha');
|
||||
$search_categ_cus = trim(GETPOST("search_categ_cus", 'int'));
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
@ -141,6 +147,11 @@ $arrayfields = array(
|
||||
'c.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
|
||||
'c.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
|
||||
'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
|
||||
'c.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'c.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'c.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'c.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10),
|
||||
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||
@ -197,6 +208,11 @@ if (empty($reshook))
|
||||
$search_total_ht = '';
|
||||
$search_total_vat = '';
|
||||
$search_total_ttc = '';
|
||||
$search_multicurrency_code = '';
|
||||
$search_multicurrency_tx = '';
|
||||
$search_multicurrency_montant_ht = '';
|
||||
$search_multicurrency_montant_vat = '';
|
||||
$search_multicurrency_montant_ttc = '';
|
||||
$search_login = '';
|
||||
$search_dateorder_start = '';
|
||||
$search_dateorder_end = '';
|
||||
@ -250,6 +266,7 @@ $sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.
|
||||
$sql .= " typent.code as typent_code,";
|
||||
$sql .= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql .= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
|
||||
$sql .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva as multicurrency_total_vat, c.multicurrency_total_ttc,';
|
||||
$sql .= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
|
||||
$sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
|
||||
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
|
||||
@ -314,25 +331,31 @@ if ($viewstatut <> '')
|
||||
}
|
||||
}
|
||||
|
||||
if ($search_dateorder_start) $sql .= " AND c.date_commande >= '".$db->idate($search_dateorder_start)."'";
|
||||
if ($search_dateorder_end) $sql .= " AND c.date_commande <= '".$db->idate($search_dateorder_end)."'";
|
||||
if ($search_datedelivery_start) $sql .= " AND c.date_livraison >= '".$db->idate($search_datedelivery_start)."'";
|
||||
if ($search_datedelivery_end) $sql .= " AND c.date_livraison <= '".$db->idate($search_datedelivery_end)."'";
|
||||
if ($search_town) $sql .= natural_search('s.town', $search_town);
|
||||
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
|
||||
if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
||||
if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
||||
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale;
|
||||
if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
if ($search_total_ht != '') $sql .= natural_search('c.total_ht', $search_total_ht, 1);
|
||||
if ($search_total_ttc != '') $sql .= natural_search('c.total_ttc', $search_total_ttc, 1);
|
||||
if ($search_login) $sql .= natural_search("u.login", $search_login);
|
||||
if ($search_project_ref != '') $sql .= natural_search("p.ref", $search_project_ref);
|
||||
if ($search_project != '') $sql .= natural_search("p.title", $search_project);
|
||||
if ($search_categ_cus > 0) $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
|
||||
if ($search_categ_cus == -2) $sql .= " AND cc.fk_categorie IS NULL";
|
||||
if ($search_dateorder_start) $sql .= " AND c.date_commande >= '".$db->idate($search_dateorder_start)."'";
|
||||
if ($search_dateorder_end) $sql .= " AND c.date_commande <= '".$db->idate($search_dateorder_end)."'";
|
||||
if ($search_datedelivery_start) $sql .= " AND c.date_livraison >= '".$db->idate($search_datedelivery_start)."'";
|
||||
if ($search_datedelivery_end) $sql .= " AND c.date_livraison <= '".$db->idate($search_datedelivery_end)."'";
|
||||
if ($search_town) $sql .= natural_search('s.town', $search_town);
|
||||
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
|
||||
if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
||||
if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
||||
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale;
|
||||
if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
if ($search_total_ht != '') $sql .= natural_search('c.total_ht', $search_total_ht, 1);
|
||||
if ($search_total_vat != '') $sql .= natural_search('c.tva', $search_total_vat, 1);
|
||||
if ($search_total_ttc != '') $sql .= natural_search('c.total_ttc', $search_total_ttc, 1);
|
||||
if ($search_multicurrency_code != '') $sql .= ' AND c.multicurrency_code = "' . $db->escape($search_multicurrency_code) . '"';
|
||||
if ($search_multicurrency_tx != '') $sql .= natural_search('c.multicurrency_tx', $search_multicurrency_tx, 1);
|
||||
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
|
||||
if ($search_multicurrency_montant_vat != '') $sql .= natural_search('c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
|
||||
if ($search_multicurrency_montant_ttc != '') $sql .= natural_search('c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
|
||||
if ($search_login) $sql .= natural_search("u.login", $search_login);
|
||||
if ($search_project_ref != '') $sql .= natural_search("p.ref", $search_project_ref);
|
||||
if ($search_project != '') $sql .= natural_search("p.title", $search_project);
|
||||
if ($search_categ_cus > 0) $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
|
||||
if ($search_categ_cus == -2) $sql .= " AND cc.fk_categorie IS NULL";
|
||||
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
@ -424,6 +447,11 @@ if ($resql)
|
||||
if ($search_total_ht != '') $param .= '&search_total_ht='.urlencode($search_total_ht);
|
||||
if ($search_total_vat != '') $param .= '&search_total_vat='.urlencode($search_total_vat);
|
||||
if ($search_total_ttc != '') $param .= '&search_total_ttc='.urlencode($search_total_ttc);
|
||||
if ($search_multicurrency_code != '') $param .= '&search_multicurrency_code='.urlencode($search_multicurrency_code);
|
||||
if ($search_multicurrency_tx != '') $param .= '&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
|
||||
if ($search_multicurrency_montant_ht != '') $param .= '&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
|
||||
if ($search_multicurrency_montant_vat != '') $param .= '&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
|
||||
if ($search_multicurrency_montant_ttc != '') $param .= '&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
|
||||
if ($search_login) $param .= '&search_login='.urlencode($search_login);
|
||||
if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref);
|
||||
if ($search_town != '') $param .= '&search_town='.urlencode($search_town);
|
||||
@ -697,6 +725,41 @@ if ($resql)
|
||||
print '<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['c.multicurrency_code']['checked']))
|
||||
{
|
||||
// Currency
|
||||
print '<td class="liste_titre">';
|
||||
print $form->selectMultiCurrency($search_multicurrency_code, 'search_multicurrency_code', 1);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['c.multicurrency_tx']['checked']))
|
||||
{
|
||||
// Currency rate
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['c.multicurrency_total_ht']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['c.multicurrency_total_vat']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['c.multicurrency_total_ttc']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['u.login']['checked']))
|
||||
{
|
||||
// Author
|
||||
@ -775,6 +838,11 @@ if ($resql)
|
||||
if (!empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'], $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'c.tva', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'], $_SERVER["PHP_SELF"], 'c.total_ttc', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($arrayfields['c.multicurrency_code']['checked'])) print_liste_field_titre($arrayfields['c.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'c.multicurrency_code', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['c.multicurrency_tx']['checked'])) print_liste_field_titre($arrayfields['c.multicurrency_tx']['label'], $_SERVER['PHP_SELF'], 'c.multicurrency_tx', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['c.multicurrency_total_ht']['checked'])) print_liste_field_titre($arrayfields['c.multicurrency_total_ht']['label'], $_SERVER['PHP_SELF'], 'c.multicurrency_total_ht', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['c.multicurrency_total_vat']['checked'])) print_liste_field_titre($arrayfields['c.multicurrency_total_vat']['label'], $_SERVER['PHP_SELF'], 'c.multicurrency_total_tva', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['c.multicurrency_total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'c.multicurrency_total_ttc', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
|
||||
// Extra fields
|
||||
@ -1097,6 +1165,40 @@ if ($resql)
|
||||
$totalarray['val']['c.total_ttc'] += $obj->total_ttc;
|
||||
}
|
||||
|
||||
// Currency
|
||||
if (!empty($arrayfields['c.multicurrency_code']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code . ' - ' . $langs->trans('Currency' . $obj->multicurrency_code)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Currency rate
|
||||
if (!empty($arrayfields['c.multicurrency_tx']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Amount HT
|
||||
if (!empty($arrayfields['c.multicurrency_total_ht']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.price($obj->multicurrency_total_ht)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Amount VAT
|
||||
if (!empty($arrayfields['c.multicurrency_total_vat']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.price($obj->multicurrency_total_vat)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Amount TTC
|
||||
if (!empty($arrayfields['c.multicurrency_total_ttc']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.price($obj->multicurrency_total_ttc)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
$userstatic->id = $obj->fk_user_author;
|
||||
$userstatic->login = $obj->login;
|
||||
|
||||
|
||||
@ -66,7 +66,14 @@ if (!$sortorder) $sortorder = "DESC";
|
||||
$arrayfields = array(
|
||||
'type'=>array('label'=>"Type", 'checked'=>1),
|
||||
'date'=>array('label'=>"Date", 'checked'=>1),
|
||||
//...
|
||||
'date_due'=>array('label'=>"DateDue", 'checked'=>1),
|
||||
'ref'=>array('label'=>"Ref", 'checked'=>1),
|
||||
'documents'=>array('label'=>"Documents", 'checked'=>1),
|
||||
'paid'=>array('label'=>"Paid", 'checked'=>1),
|
||||
'total_ht'=>array('label'=>"TotalHT", 'checked'=>1),
|
||||
'total_ttc'=>array('label'=>"TotalTTC", 'checked'=>1),
|
||||
'total_vat'=>array('label'=>"TotalVAT", 'checked'=>1),
|
||||
//...
|
||||
);
|
||||
|
||||
// Security check
|
||||
@ -127,7 +134,7 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
// Customer invoices
|
||||
if (GETPOST('selectinvoices')) {
|
||||
if (! empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= "SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, total as total_ht, total_ttc, tva as total_vat, fk_soc, t.datef as date, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum";
|
||||
$sql .= "SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total as total_ht, t.total_ttc, t.tva as total_vat, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
|
||||
$sql .= " WHERE datef between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
|
||||
@ -136,7 +143,7 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
// Vendor invoices
|
||||
if (GETPOST('selectsupplierinvoices')) {
|
||||
if (! empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, paye as paid, total_ht, total_ttc, total_tva as total_vat, fk_soc, datef as date, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
|
||||
$sql .= " WHERE datef between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
|
||||
@ -145,7 +152,7 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
// Expense reports
|
||||
if (GETPOST('selectexpensereports')) {
|
||||
if (! empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, total_ht, total_ttc, total_tva as total_vat, fk_user_author as fk_soc, date_fin as date, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.fk_user_author as fk_soc, t.date_fin as date, t.date_fin as date_due, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user_author LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country";
|
||||
$sql .= " WHERE date_fin between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
|
||||
@ -154,7 +161,7 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
// Donations
|
||||
if (GETPOST('selectdonations')) {
|
||||
if (! empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, datedon as date, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, t.datedon as date, t.datedon as date_due, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."don as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_country";
|
||||
$sql .= " WHERE datedon between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
|
||||
@ -163,7 +170,7 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
// Paiements of salaries
|
||||
if (GETPOST('selectpaymentsofsalaries')) {
|
||||
if (! empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, datep as date, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, t.datep as date, t.dateep as date_due, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country";
|
||||
$sql .= " WHERE datep between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
|
||||
@ -172,7 +179,7 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
// Social contributions
|
||||
if (GETPOST('selectsocialcontributions')) {
|
||||
if (! empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, paye as paid, amount as total_ht, amount as total_ttc, 0 as total_tva, 0 as fk_soc, date_creation as date, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, t.paye as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_tva, 0 as fk_soc, t.date_creation as date, t.date_ech as date_due, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as t";
|
||||
$sql .= " WHERE date_creation between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
|
||||
@ -261,7 +268,8 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
$nofile['id'] = $objd->id;
|
||||
$nofile['entity'] = $objd->entity;
|
||||
$nofile['date'] = $db->idate($objd->date);
|
||||
$nofile['paid'] = $objd->paid;
|
||||
$nofile['date_due'] = $db->idate($objd->date_due);
|
||||
$nofile['paid'] = $objd->paid;
|
||||
$nofile['amount_ht'] = $objd->total_ht;
|
||||
$nofile['amount_ttc'] = $objd->total_ttc;
|
||||
$nofile['amount_vat'] = $objd->total_vat;
|
||||
@ -282,7 +290,8 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
$file['id'] = $objd->id;
|
||||
$file['entity'] = $objd->entity;
|
||||
$file['date'] = $db->idate($objd->date);
|
||||
$file['paid'] = $objd->paid;
|
||||
$file['date_due'] = $db->idate($objd->date_due);
|
||||
$file['paid'] = $objd->paid;
|
||||
$file['amount_ht'] = $objd->total_ht;
|
||||
$file['amount_ttc'] = $objd->total_ttc;
|
||||
$file['amount_vat'] = $objd->total_vat;
|
||||
@ -357,12 +366,14 @@ if ($result && $action == "dl" && !$error)
|
||||
$log .= ','.$langs->transnoentitiesnoconv("Entity");
|
||||
}
|
||||
$log .= ','.$langs->transnoentitiesnoconv("Date");
|
||||
$log .= ','.$langs->transnoentitiesnoconv("DateDue");
|
||||
$log .= ','.$langs->transnoentitiesnoconv("Ref");
|
||||
$log .= ','.$langs->transnoentitiesnoconv("TotalHT");
|
||||
$log .= ','.$langs->transnoentitiesnoconv("TotalTTC");
|
||||
$log .= ','.$langs->transnoentitiesnoconv("TotalVAT");
|
||||
$log .= ','.$langs->transnoentitiesnoconv("Paid");
|
||||
$log .= ',filename,item_id';
|
||||
$log .= ','.$langs->transnoentitiesnoconv("Document");
|
||||
$log .= ','.$langs->transnoentitiesnoconv("ItemID");
|
||||
$log .= ','.$langs->transnoentitiesnoconv("ThirdParty");
|
||||
$log .= ','.$langs->transnoentitiesnoconv("Code");
|
||||
$log .= ','.$langs->transnoentitiesnoconv("Country");
|
||||
@ -389,6 +400,7 @@ if ($result && $action == "dl" && !$error)
|
||||
$log .= ',"'.(empty($arrayofentities[$file['entity']]) ? $file['entity'] : $arrayofentities[$file['entity']]).'"';
|
||||
}
|
||||
$log .= ','.dol_print_date($file['date'], 'dayrfc');
|
||||
$log .= ','.dol_print_date($file['date_due'], 'dayrfc');
|
||||
$log .= ',"'.$file['ref'].'"';
|
||||
$log .= ','.$file['amount_ht'];
|
||||
$log .= ','.$file['amount_ttc'];
|
||||
@ -397,7 +409,7 @@ if ($result && $action == "dl" && !$error)
|
||||
$log .= ',"'.$file["name"].'"';
|
||||
$log .= ','.$file['fk'];
|
||||
$log .= ',"'.$file['thirdparty_name'].'"';
|
||||
$log .= ','.$file['thirdparty_code'];
|
||||
$log .= ',"'.$file['thirdparty_code'].'"';
|
||||
$log .= ',"'.$file['country_code'].'"';
|
||||
$log .= ',"'.$file['vatnum'].'"';
|
||||
$log .= "\n";
|
||||
@ -428,6 +440,8 @@ if ($result && $action == "dl" && !$error)
|
||||
|
||||
$form = new Form($db);
|
||||
$userstatic = new User($db);
|
||||
$invoice = new Facture($db);
|
||||
$supplier_invoice = new FactureFournisseur($db);
|
||||
|
||||
$title = $langs->trans("ComptaFiles").' - '.$langs->trans("List");
|
||||
$help_url = '';
|
||||
@ -475,10 +489,8 @@ $listofchoices = array(
|
||||
'selectsocialcontributions'=>array('label'=>'SocialContributions')
|
||||
);
|
||||
foreach($listofchoices as $choice => $val) {
|
||||
/*if ($val['lang']) {
|
||||
$langs->load($val['lang']);
|
||||
}*/
|
||||
print '<div class="paddingleft inline-block marginrightonly"><input type="checkbox" name="'.$choice.'" value="1"'.((! GETPOSTISSET('search') || GETPOST($choice))?' checked="checked"':'').'> '.$langs->trans($val['label']).'</div>';
|
||||
$checked = (((! GETPOSTISSET('search') && $action != 'searchfiles') || GETPOST($choice))?' checked="checked"':'');
|
||||
print '<div class="paddingleft inline-block marginrightonly"><input type="checkbox" name="'.$choice.'" value="1"'.$checked.'> '.$langs->trans($val['label']).'</div>';
|
||||
}
|
||||
|
||||
print '<input class="button" type="submit" name="search" value="'.$langs->trans("Search").'">';
|
||||
@ -496,7 +508,9 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
$param .= '&date_stopday='.GETPOST('date_stopday', 'int');
|
||||
$param .= '&date_stopmonth='.GETPOST('date_stopmonth', 'int');
|
||||
$param .= '&date_stopyear='.GETPOST('date_stopyear', 'int');
|
||||
|
||||
foreach($listofchoices as $choice => $val) {
|
||||
$param.='&'.$choice.'='.(GETPOST($choice, 'int')?1:0);
|
||||
}
|
||||
print '<form name="dl" action="?action=dl" method="POST" >'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
@ -518,7 +532,8 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], "item", "", $param, '', $sortfield, $sortorder, 'nowrap ');
|
||||
print_liste_field_titre($arrayfields['date']['label'], $_SERVER["PHP_SELF"], "date", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
print '<td>'.$langs->trans("Ref").'</td>';
|
||||
print_liste_field_titre($arrayfields['date_due']['label'], $_SERVER["PHP_SELF"], "date_due", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
print_liste_field_titre($arrayfields['ref']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'nowraponall ');
|
||||
print '<td>'.$langs->trans("Document").'</td>';
|
||||
print '<td>'.$langs->trans("Paid").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalHT").'</td>';
|
||||
@ -563,8 +578,26 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
print dol_print_date($data['date'], 'day');
|
||||
print "</td>\n";
|
||||
|
||||
// Date
|
||||
print '<td class="center">';
|
||||
print dol_print_date($data['date_due'], 'day');
|
||||
print "</td>\n";
|
||||
|
||||
// Ref
|
||||
print '<td aling="left">'.$data['ref'].'</td>';
|
||||
print '<td class="nowraponall">';
|
||||
|
||||
if ($data['item'] == 'Invoice') {
|
||||
$invoice->id = $data['id'];
|
||||
$invoice->ref = $data['ref'];
|
||||
print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
|
||||
} elseif ($data['item'] == 'SupplierInvoice') {
|
||||
$supplier_invoice->id = $data['id'];
|
||||
$supplier_invoice->ref = $data['ref'];
|
||||
print $supplier_invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
|
||||
} else {
|
||||
print $data['ref'];
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// File link
|
||||
print '<td>';
|
||||
@ -618,6 +651,7 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td align="right">'.price(price2num($totalET, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalIT, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalVAT, 'MT')).'</td>';
|
||||
|
||||
@ -350,10 +350,11 @@ else
|
||||
}
|
||||
$datamin[$i] = $object->min_desired;
|
||||
$dataall[$i] = $object->min_allowed;
|
||||
if ($xday == '15')
|
||||
/*if ($xday == '15') // Set only some label for jflot
|
||||
{
|
||||
$labels[$i] = dol_print_date($day, "%b");
|
||||
}
|
||||
}*/
|
||||
$labels[$i] = dol_print_date($day, "%Y%m");
|
||||
$day += 86400;
|
||||
$textdate = strftime("%Y%m%d", $day);
|
||||
$xyear = substr($textdate, 0, 4);
|
||||
@ -465,10 +466,11 @@ else
|
||||
}
|
||||
$datamin[$i] = $object->min_desired;
|
||||
$dataall[$i] = $object->min_allowed;
|
||||
if (substr($textdate, 6, 2) == '01' || $i == 0)
|
||||
/*if (substr($textdate, 6, 2) == '01' || $i == 0) // Set only few label for jflot
|
||||
{
|
||||
$labels[$i] = substr($textdate, 4, 2);
|
||||
}
|
||||
$labels[$i] = substr($textdate, 0, 6);
|
||||
}*/
|
||||
$labels[$i] = substr($textdate, 0, 6);
|
||||
|
||||
$day += 86400;
|
||||
$textdate = strftime("%Y%m%d", $day);
|
||||
@ -815,6 +817,8 @@ else
|
||||
}
|
||||
print '<br><br></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
// Graphs
|
||||
if ($mode == 'standard')
|
||||
@ -826,39 +830,39 @@ if ($mode == 'standard')
|
||||
|
||||
// For month
|
||||
$link = "<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"] != 'all' ? '' : '&option=all')."&year=".$prevyear."&month=".$prevmonth."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Month")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".$nextyear."&month=".$nextmonth."'>".img_next('', 'class="valignbottom"')."</a>";
|
||||
print '<tr><td class="right">'.$link.'</td></tr>';
|
||||
print '<div class="right clearboth">'.$link.'</div>';
|
||||
|
||||
print '<tr><td class="center">';
|
||||
print '<div class="center clearboth margintoponly">';
|
||||
$file = "movement".$account."-".$year.$month.".png";
|
||||
print $show4;
|
||||
print '</td></tr>';
|
||||
print '</div>';
|
||||
|
||||
print '<tr><td class="center">';
|
||||
print '<div class="center clearboth margintoponly">';
|
||||
print $show1;
|
||||
print '</td></tr>';
|
||||
print '</div>';
|
||||
|
||||
// For year
|
||||
$prevyear = $year - 1; $nextyear = $year + 1;
|
||||
$link = "<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"] != 'all' ? '' : '&option=all')."&year=".($prevyear)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".($nextyear)."'>".img_next('', 'class="valignbottom"')."</a>";
|
||||
print '<tr><td class="right">'.$link.'</td></tr>';
|
||||
|
||||
print '<tr><td class="center">';
|
||||
print '<div class="right clearboth margintoponly">'.$link.'</div>';
|
||||
|
||||
print '<div class="center clearboth margintoponly">';
|
||||
print $show5;
|
||||
print '</td></tr>';
|
||||
print '</div>';
|
||||
|
||||
print '<tr><td class="center">';
|
||||
print '<div class="center clearboth margintoponly">';
|
||||
print $show2;
|
||||
print '</td></tr>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if ($mode == 'showalltime')
|
||||
{
|
||||
print '<tr><td class="center">';
|
||||
print '<div class="center clearboth margintoponly">';
|
||||
print $show3;
|
||||
print '</td></tr>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.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
|
||||
@ -30,8 +31,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php';
|
||||
if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
if (!empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('banks', 'categories', 'accountancy', 'compta'));
|
||||
@ -49,6 +52,11 @@ $search_number=GETPOST('search_number', 'alpha');
|
||||
$search_status=GETPOST('search_status')?GETPOST('search_status', 'alpha'):'opened'; // 'all' or ''='opened'
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
if (!empty($conf->categorie->enabled))
|
||||
{
|
||||
$search_category_list = GETPOST("search_category_".Categorie::TYPE_ACCOUNT."_list", "array");
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
if (! empty($user->rights->accounting->chartofaccount)) $allowed=1; // Dictionary with list of banks accounting account allowed to manager of chart account
|
||||
@ -138,9 +146,9 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new FormCategory($db);
|
||||
|
||||
$title=$langs->trans('BankAccounts');
|
||||
$title = $langs->trans('BankAccounts');
|
||||
|
||||
// Load array of financial accounts (opened by default)
|
||||
$accounts = array();
|
||||
@ -151,14 +159,26 @@ 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.' as options_'.$key : '');
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$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."bank_account as b";
|
||||
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 (b.rowid = ef.fk_object)";
|
||||
|
||||
if (!empty($conf->categorie->enabled))
|
||||
{
|
||||
$sql .= Categorie::getFilterJoinQuery(Categorie::TYPE_ACCOUNT, "b.rowid");
|
||||
}
|
||||
|
||||
$sql.= " WHERE b.entity IN (".getEntity('bank_account').")";
|
||||
if ($search_status == 'opened') $sql.= " AND clos = 0";
|
||||
if ($search_status == 'closed') $sql.= " AND clos = 1";
|
||||
|
||||
if (!empty($conf->categorie->enabled))
|
||||
{
|
||||
$sql .= Categorie::getFilterSelectQuery(Categorie::TYPE_ACCOUNT, "b.rowid", $search_category_list);
|
||||
}
|
||||
|
||||
if ($search_ref != '') $sql.=natural_search('b.ref', $search_ref);
|
||||
if ($search_label != '') $sql.=natural_search('b.label', $search_label);
|
||||
if ($search_number != '') $sql.=natural_search('b.number', $search_number);
|
||||
@ -263,6 +283,10 @@ if ($sall)
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
if (!empty($conf->categorie->enabled))
|
||||
{
|
||||
$moreforfilter .= $form->getFilterBox(Categorie::TYPE_ACCOUNT, $search_category_list);
|
||||
}
|
||||
|
||||
// Bank accounts
|
||||
$parameters = array();
|
||||
|
||||
@ -115,10 +115,10 @@ if ($conf->use_javascript_ajax)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setWidth('100%');
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphstatus');
|
||||
print $dolgraph->show($totalnb?0:1);
|
||||
|
||||
|
||||
@ -297,31 +297,32 @@ if (empty($reshook))
|
||||
|
||||
// Also negative lines should not be allowed on 'non Credit notes' invoices. A test is done when adding or updating lines but we must
|
||||
// do it again in validation to avoid cases where invoice is created from another object that allow negative lines.
|
||||
// Note that we can accept the negative line if sum with other lines with same vat is positivie: Because all the lines will be merged together
|
||||
// Note that we can accept the negative line if sum with other lines with same vat makes total positive: Because all the lines will be merged together
|
||||
// when converted into 'available credit' and we will get a positive available credit line.
|
||||
// Note: Other solution if you want to add a negative line on invoice, is to create a discount for customer and consumme it (but this is possible on standard invoice only).
|
||||
$array_of_pu_ht_per_vat_rate = array();
|
||||
$array_of_pu_ht_devise_per_vat_rate = array();
|
||||
foreach ($object->lines as $line) {
|
||||
if (empty($array_of_pu_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_pu_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0;
|
||||
if (empty($array_of_pu_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_pu_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0;
|
||||
$array_of_pu_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->subprice;
|
||||
$array_of_pu_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->multicurrency_subprice;
|
||||
$array_of_total_ht_per_vat_rate = array();
|
||||
$array_of_total_ht_devise_per_vat_rate = array();
|
||||
foreach($object->lines as $line) {
|
||||
if (empty($array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0;
|
||||
if (empty($array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0;
|
||||
$array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->total_ht;
|
||||
$array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->multicurrency_total_ht;
|
||||
}
|
||||
//var_dump($array_of_pu_ht_per_vat_rate);exit;
|
||||
foreach ($array_of_pu_ht_per_vat_rate as $vatrate => $tmpvalue)
|
||||
{
|
||||
$pu_ht = $array_of_pu_ht_per_vat_rate[$vatrate];
|
||||
$pu_ht_devise = $array_of_pu_ht_devise_per_vat_rate[$vatrate];
|
||||
|
||||
if (($pu_ht < 0 || $pu_ht_devise < 0) && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES))
|
||||
//var_dump($array_of_total_ht_per_vat_rate);exit;
|
||||
foreach($array_of_total_ht_per_vat_rate as $vatrate => $tmpvalue)
|
||||
{
|
||||
$tmp_total_ht = $array_of_total_ht_per_vat_rate[$vatrate];
|
||||
$tmp_total_ht_devise = $array_of_total_ht_devise_per_vat_rate[$vatrate];
|
||||
|
||||
if (($tmp_total_ht < 0 || $tmp_total_ht_devise < 0) && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES))
|
||||
{
|
||||
$langs->load("errors");
|
||||
if ($object->type == $object::TYPE_DEPOSIT) {
|
||||
// Using negative lines on deposit lead to headach and blocking problems when you want to consume them.
|
||||
setEventMessages($langs->trans("ErrorLinesCantBeNegativeOnDeposits"), null, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT"), $langs->transnoentitiesnoconv("CustomerAbsoluteDiscountShort")), null, 'errors');
|
||||
setEventMessages($langs->trans("ErrorLinesCantBeNegativeForOneVATRate"), null, 'errors');
|
||||
}
|
||||
$error++;
|
||||
$action = '';
|
||||
@ -5099,7 +5100,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
// Reverse back money or convert to reduction
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_SITUATION) {
|
||||
// For credit note only
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $usercanissuepayment)
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercanissuepayment)
|
||||
{
|
||||
if ($resteapayer == 0)
|
||||
{
|
||||
@ -5112,13 +5113,13 @@ elseif ($id > 0 || !empty($ref))
|
||||
}
|
||||
|
||||
// For standard invoice with excess received
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_SITUATION) && empty($object->paye) && $resteapayer < 0 && $usercancreate && empty($discount->id))
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_SITUATION) && $object->statut == Facture::STATUS_VALIDATED && empty($object->paye) && $resteapayer < 0 && $usercancreate && empty($discount->id))
|
||||
{
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc">'.$langs->trans('ConvertExcessReceivedToReduc').'</a>';
|
||||
}
|
||||
// For credit note
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $usercancreate
|
||||
&& (!empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) || $object->getSommePaiement() == 0)
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercancreate
|
||||
&& (! empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) || $object->getSommePaiement() == 0)
|
||||
) {
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReduc2")).'">'.$langs->trans('ConvertToReduc').'</a>';
|
||||
}
|
||||
@ -5130,7 +5131,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
}
|
||||
|
||||
// Classify paid
|
||||
if (($object->statut == 1 && $object->paye == 0 && $usercanissuepayment && (($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0)))
|
||||
if (($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercanissuepayment && (($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0)))
|
||||
|| ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && $usercanissuepayment && empty($discount->id))
|
||||
)
|
||||
{
|
||||
@ -5139,7 +5140,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
|
||||
// Classify 'closed not completely paid' (possible si validee et pas encore classee payee)
|
||||
|
||||
if ($object->statut == 1 && $object->paye == 0 && $resteapayer > 0 && $usercanissuepayment)
|
||||
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && $usercanissuepayment)
|
||||
{
|
||||
if ($totalpaye > 0 || $totalcreditnotes > 0)
|
||||
{
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
/* Copyright (C) 2020 Thibault FOUCART <support@ptibogxiv.net>
|
||||
*
|
||||
* 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
|
||||
@ -63,11 +64,65 @@ class Invoices extends DolibarrApi
|
||||
*/
|
||||
public function get($id, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch($id, '', '', $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties of an invoice object by ref
|
||||
*
|
||||
* Return an array with invoice informations
|
||||
*
|
||||
* @param string $ref Ref of object
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @url GET ref/{ref}
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getByRef($ref, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch('', $ref, '', $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties of an invoice object by ref_ext
|
||||
*
|
||||
* Return an array with invoice informations
|
||||
*
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @url GET ref_ext/{ref_ext}
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getByRefExt($ref_ext, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch('', '', $ref_ext, $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties of an invoice object
|
||||
*
|
||||
* Return an array with invoice informations
|
||||
*
|
||||
* @param int $id ID of order
|
||||
* @param string $ref Ref of object
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->facture->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->invoice->fetch($id);
|
||||
$result = $this->invoice->fetch($id, $ref, $ref_ext);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
@ -87,7 +142,7 @@ class Invoices extends DolibarrApi
|
||||
|
||||
$this->invoice->fetchObjectLinked();
|
||||
return $this->_cleanObjectDatas($this->invoice);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* List invoices
|
||||
@ -424,7 +479,7 @@ class Invoices extends DolibarrApi
|
||||
* @url DELETE {id}/contact/{rowid}
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
*
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
@ -592,6 +647,7 @@ class Invoices extends DolibarrApi
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws RestException 304
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 400
|
||||
@ -1098,6 +1154,7 @@ class Invoices extends DolibarrApi
|
||||
* @url POST {id}/usediscount/{discountid}
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws RestException 400
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
@ -1144,6 +1201,7 @@ class Invoices extends DolibarrApi
|
||||
* @url POST {id}/usecreditnote/{discountid}
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws RestException 400
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
@ -1189,7 +1247,7 @@ class Invoices extends DolibarrApi
|
||||
* @url GET {id}/payments
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
*
|
||||
* @throws RestException 400
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
@ -1239,6 +1297,7 @@ class Invoices extends DolibarrApi
|
||||
* @url POST {id}/payments
|
||||
*
|
||||
* @return int Payment ID
|
||||
*
|
||||
* @throws RestException 400
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
@ -1358,6 +1417,7 @@ class Invoices extends DolibarrApi
|
||||
* @url POST /paymentsdistributed
|
||||
*
|
||||
* @return int Payment ID
|
||||
*
|
||||
* @throws RestException 400
|
||||
* @throws RestException 401
|
||||
* @throws RestException 403
|
||||
|
||||
@ -112,7 +112,13 @@ class Facture extends CommonInvoice
|
||||
public $date; // Date invoice
|
||||
public $datem;
|
||||
public $ref_client;
|
||||
public $ref_int;
|
||||
|
||||
/**
|
||||
* @var int Ref Int
|
||||
* @deprecated
|
||||
*/
|
||||
public $ref_int; // deprecated
|
||||
|
||||
//Check constants for types
|
||||
public $type = self::TYPE_STANDARD;
|
||||
|
||||
@ -255,10 +261,10 @@ class Facture extends CommonInvoice
|
||||
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15),
|
||||
'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),
|
||||
'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),
|
||||
'increment' =>array('type'=>'varchar(10)', 'label'=>'Increment', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||
//'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),
|
||||
@ -267,18 +273,17 @@ class Facture extends CommonInvoice
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>75),
|
||||
'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'=>'Remise percent', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'remise_absolue' =>array('type'=>'double', 'label'=>'Remise absolue', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||
'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' =>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),
|
||||
'tva' =>array('type'=>'double(24,8)', 'label'=>'TotalVAT', 'enabled'=>1, 'visible'=>-1, 'position'=>115, 'isameasure'=>1),
|
||||
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'Localtax1', 'enabled'=>1, 'visible'=>-1, 'position'=>120, 'isameasure'=>1),
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
|
||||
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>120, 'isameasure'=>1),
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', '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' =>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_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')),
|
||||
'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),
|
||||
@ -300,20 +305,21 @@ class Facture extends CommonInvoice
|
||||
'retained_warranty' =>array('type'=>'double', 'label'=>'Retained warranty', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>245),
|
||||
'retained_warranty_date_limit' =>array('type'=>'date', 'label'=>'Retained warranty date limit', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>250),
|
||||
'retained_warranty_fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Retained warranty fk cond reglement', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>255),
|
||||
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermsCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>260),
|
||||
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermsLocation', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>265),
|
||||
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>260),
|
||||
'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'=>'MulticurrencyCode', '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),
|
||||
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ht', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>290),
|
||||
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total tva', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>295),
|
||||
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ttc', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>300),
|
||||
'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_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),
|
||||
'fk_fac_rec_source' =>array('type'=>'integer', 'label'=>'RecurringInvoiceSource', 'enabled'=>1, 'visible'=>-1, 'position'=>305),
|
||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>310),
|
||||
'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),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>220),
|
||||
'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')),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
|
||||
);
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
@ -477,7 +483,7 @@ class Facture extends CommonInvoice
|
||||
$this->fk_project = GETPOST('projectid', 'int') > 0 ? ((int) GETPOST('projectid', 'int')) : $_facrec->fk_project;
|
||||
$this->note_public = GETPOST('note_public', 'none') ? GETPOST('note_public', 'none') : $_facrec->note_public;
|
||||
$this->note_private = GETPOST('note_private', 'none') ? GETPOST('note_private', 'none') : $_facrec->note_private;
|
||||
$this->modelpdf = GETPOST('model', 'alpha') ? GETPOST('model', 'apha') : $_facrec->modelpdf;
|
||||
$this->modelpdf = GETPOST('model', 'alpha') ? GETPOST('model', 'alpha') : $_facrec->modelpdf;
|
||||
$this->cond_reglement_id = GETPOST('cond_reglement_id', 'int') > 0 ? ((int) GETPOST('cond_reglement_id', 'int')) : $_facrec->cond_reglement_id;
|
||||
$this->mode_reglement_id = GETPOST('mode_reglement_id', 'int') > 0 ? ((int) GETPOST('mode_reglement_id', 'int')) : $_facrec->mode_reglement_id;
|
||||
$this->fk_account = GETPOST('fk_account') > 0 ? ((int) GETPOST('fk_account')) : $_facrec->fk_account;
|
||||
@ -1458,18 +1464,18 @@ class Facture extends CommonInvoice
|
||||
/**
|
||||
* Get object from database. Get also lines.
|
||||
*
|
||||
* @param int $rowid Id of object to load
|
||||
* @param string $ref Reference of invoice
|
||||
* @param string $ref_ext External reference of invoice
|
||||
* @param int $ref_int Internal reference of other object
|
||||
* @param int $rowid Id of object to load
|
||||
* @param string $ref Reference of invoice
|
||||
* @param string $ref_ext External reference of invoice
|
||||
* @param int $notused Not used
|
||||
* @param bool $fetch_situation Fetch the previous and next situation in $tab_previous_situation_invoice and $tab_next_situation_invoice
|
||||
* @return int >0 if OK, <0 if KO, 0 if not found
|
||||
* @return int >0 if OK, <0 if KO, 0 if not found
|
||||
*/
|
||||
public function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '', $fetch_situation = false)
|
||||
public function fetch($rowid, $ref = '', $ref_ext = '', $notused = '', $fetch_situation = false)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
|
||||
if (empty($rowid) && empty($ref) && empty($ref_ext)) return -1;
|
||||
|
||||
$sql = 'SELECT f.rowid,f.entity,f.ref,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc';
|
||||
$sql .= ', f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp';
|
||||
@ -1501,7 +1507,7 @@ class Facture extends CommonInvoice
|
||||
$sql .= ' WHERE f.entity IN ('.getEntity('invoice').')'; // Dont't use entity if you use rowid
|
||||
if ($ref) $sql .= " AND f.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql .= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql .= " AND f.ref_int='".$this->db->escape($ref_int)."'";
|
||||
if ($notused) $sql .= " AND f.ref_int='".$this->db->escape($notused)."'"; // deprecated
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
@ -2538,7 +2544,7 @@ class Facture extends CommonInvoice
|
||||
{
|
||||
$num = $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
if ($num)
|
||||
{
|
||||
|
||||
@ -205,10 +205,11 @@ class FactureStats extends Stats
|
||||
/**
|
||||
* Return nb, amount of predefined product for year
|
||||
*
|
||||
* @param int $year Year to scan
|
||||
* @return array Array of values
|
||||
* @param int $year Year to scan
|
||||
* @param int $limit Limit
|
||||
* @return array Array of values
|
||||
*/
|
||||
public function getAllByProduct($year)
|
||||
public function getAllByProduct($year, $limit = 10)
|
||||
{
|
||||
global $user;
|
||||
|
||||
@ -222,6 +223,6 @@ class FactureStats extends Stats
|
||||
$sql.= $this->db->order('nb', 'DESC');
|
||||
//$sql.= $this->db->plimit(20);
|
||||
|
||||
return $this->_getAllByProduct($sql);
|
||||
return $this->_getAllByProduct($sql, $limit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -536,21 +536,21 @@ if ($resql)
|
||||
}
|
||||
if (!empty($arrayfields['f.total']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($objp->total).'</td>'."\n";
|
||||
print '<td class="nowrap right">'.price($objp->total).'</td>'."\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total';
|
||||
$totalarray['val']['f.total'] += $objp->total;
|
||||
}
|
||||
if (!empty($arrayfields['f.tva']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($objp->total_vat).'</td>'."\n";
|
||||
print '<td class="nowrap right">'.price($objp->total_vat).'</td>'."\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.tva';
|
||||
$totalarray['val']['f.tva'] += $objp->total_vat;
|
||||
}
|
||||
if (!empty($arrayfields['f.total_ttc']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($objp->total_ttc).'</td>'."\n";
|
||||
print '<td class="nowrap right">'.price($objp->total_ttc).'</td>'."\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc';
|
||||
$totalarray['val']['f.total_ttc'] += $objp->total_ttc;
|
||||
|
||||
@ -87,6 +87,11 @@ $search_montant_vat = GETPOST('search_montant_vat', 'alpha');
|
||||
$search_montant_localtax1 = GETPOST('search_montant_localtax1', 'alpha');
|
||||
$search_montant_localtax2 = GETPOST('search_montant_localtax2', 'alpha');
|
||||
$search_montant_ttc = GETPOST('search_montant_ttc', 'alpha');
|
||||
$search_multicurrency_code = GETPOST('search_multicurrency_code', 'alpha');
|
||||
$search_multicurrency_tx = GETPOST('search_multicurrency_tx', 'alpha');
|
||||
$search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'alpha');
|
||||
$search_multicurrency_montant_vat = GETPOST('search_multicurrency_montant_vat', 'alpha');
|
||||
$search_multicurrency_montant_ttc = GETPOST('search_multicurrency_montant_ttc', 'alpha');
|
||||
$search_status = GETPOST('search_status', 'intcomma');
|
||||
$search_paymentmode = GETPOST('search_paymentmode', 'int');
|
||||
$search_paymentterms = GETPOST('search_paymentterms', 'int');
|
||||
@ -183,6 +188,13 @@ $arrayfields = array(
|
||||
'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>130),
|
||||
'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),
|
||||
'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),
|
||||
'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>210),
|
||||
'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>220), // Not enabled by default because slow
|
||||
'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||
'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||
'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
||||
@ -236,6 +248,11 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
|
||||
$search_montant_localtax1 = '';
|
||||
$search_montant_localtax2 = '';
|
||||
$search_montant_ttc = '';
|
||||
$search_multicurrency_code = '';
|
||||
$search_multicurrency_tx = '';
|
||||
$search_multicurrency_montant_ht = '';
|
||||
$search_multicurrency_montant_vat = '';
|
||||
$search_multicurrency_montant_ttc = '';
|
||||
$search_status = '';
|
||||
$search_paymentmode = '';
|
||||
$search_paymentterms = '';
|
||||
@ -383,6 +400,7 @@ $sql = 'SELECT';
|
||||
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
||||
$sql .= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
|
||||
$sql .= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
|
||||
$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_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,';
|
||||
@ -394,7 +412,7 @@ $sql .= " country.code as country_code,";
|
||||
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
|
||||
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
|
||||
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
|
||||
if (!$sall) $sql .= ', SUM(pf.amount) as dynamount_payed';
|
||||
if (!$sall) $sql .= ', SUM(pf.amount) as dynamount_payed, SUM(pf.multicurrency_amount) as multicurrency_dynamount_payed';
|
||||
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
@ -459,6 +477,11 @@ if ($search_montant_vat != '') $sql .= natural_search('f.tva', $search_montant_v
|
||||
if ($search_montant_localtax1 != '') $sql .= natural_search('f.localtax1', $search_montant_localtax1, 1);
|
||||
if ($search_montant_localtax2 != '') $sql .= natural_search('f.localtax2', $search_montant_localtax2, 1);
|
||||
if ($search_montant_ttc != '') $sql .= natural_search('f.total_ttc', $search_montant_ttc, 1);
|
||||
if ($search_multicurrency_code != '') $sql .= ' AND f.multicurrency_code = "' . $db->escape($search_multicurrency_code) . '"';
|
||||
if ($search_multicurrency_tx != '') $sql .= natural_search('f.multicurrency_tx', $search_multicurrency_tx, 1);
|
||||
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
|
||||
if ($search_multicurrency_montant_vat != '') $sql .= natural_search('f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
|
||||
if ($search_multicurrency_montant_ttc != '') $sql .= natural_search('f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
|
||||
if ($search_categ_cus > 0) $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
|
||||
if ($search_categ_cus == -2) $sql .= " AND cc.fk_categorie IS NULL";
|
||||
if ($search_status != '-1' && $search_status != '')
|
||||
@ -591,6 +614,11 @@ if ($resql)
|
||||
if ($search_montant_localtax1 != '') $param .= '&search_montant_localtax1='.urlencode($search_montant_localtax1);
|
||||
if ($search_montant_localtax2 != '') $param .= '&search_montant_localtax2='.urlencode($search_montant_localtax2);
|
||||
if ($search_montant_ttc != '') $param .= '&search_montant_ttc='.urlencode($search_montant_ttc);
|
||||
if ($search_multicurrency_code != '') $param .= '&search_multicurrency_code='.urlencode($search_multicurrency_code);
|
||||
if ($search_multicurrency_tx != '') $param .= '&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
|
||||
if ($search_multicurrency_montant_ht != '') $param .= '&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
|
||||
if ($search_multicurrency_montant_vat != '') $param .= '&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
|
||||
if ($search_multicurrency_montant_ttc != '') $param .= '&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
|
||||
if ($search_status != '') $param .= '&search_status='.urlencode($search_status);
|
||||
if ($search_paymentmode > 0) $param .= '&search_paymentmode='.urlencode($search_paymentmode);
|
||||
if ($search_paymentterms > 0) $param .= '&search_paymentterms='.urlencode($search_paymentterms);
|
||||
@ -878,13 +906,11 @@ if ($resql)
|
||||
print '<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['f.retained_warranty']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['dynamount_payed']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre right">';
|
||||
@ -895,6 +921,51 @@ if ($resql)
|
||||
print '<td class="liste_titre right">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['f.multicurrency_code']['checked']))
|
||||
{
|
||||
// Currency
|
||||
print '<td class="liste_titre">';
|
||||
print $form->selectMultiCurrency($search_multicurrency_code, 'search_multicurrency_code', 1);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['f.multicurrency_tx']['checked']))
|
||||
{
|
||||
// Currency rate
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['f.multicurrency_total_ht']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['f.multicurrency_total_vat']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['f.multicurrency_total_ttc']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['multicurrency_dynamount_payed']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['multicurrency_rtp']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre right">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['f.date_closing']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
@ -936,31 +1007,38 @@ if ($resql)
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($arrayfields['f.ref']['label'], $_SERVER['PHP_SELF'], 'f.ref', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.ref_client']['checked'])) print_liste_field_titre($arrayfields['f.ref_client']['label'], $_SERVER["PHP_SELF"], 'f.ref_client', '', $param, '', $sortfield, $sortorder);
|
||||
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'])) print_liste_field_titre($arrayfields['f.date']['label'], $_SERVER['PHP_SELF'], 'f.datef', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.date_lim_reglement']['checked'])) print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'], $_SERVER['PHP_SELF'], "f.date_lim_reglement", '', $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['p.title']['checked'])) print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER['PHP_SELF'], "p.title", '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER['PHP_SELF'], 's.nom', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "f.fk_mode_reglement", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "f.fk_cond_reglement", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.module_source']['checked'])) print_liste_field_titre($arrayfields['f.module_source']['label'], $_SERVER["PHP_SELF"], "f.module_source", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.pos_source']['checked'])) print_liste_field_titre($arrayfields['f.pos_source']['label'], $_SERVER["PHP_SELF"], "f.pos_source", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], 'f.total', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'], $_SERVER['PHP_SELF'], 'f.tva', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.total_localtax2']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax2']['label'], $_SERVER['PHP_SELF'], 'f.localtax2', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.total_ttc', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.retained_warranty']['checked'])) print_liste_field_titre($arrayfields['f.retained_warranty']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($arrayfields['f.ref']['label'], $_SERVER['PHP_SELF'], 'f.ref', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.ref_client']['checked'])) print_liste_field_titre($arrayfields['f.ref_client']['label'], $_SERVER["PHP_SELF"], 'f.ref_client', '', $param, '', $sortfield, $sortorder);
|
||||
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'])) print_liste_field_titre($arrayfields['f.date']['label'], $_SERVER['PHP_SELF'], 'f.datef', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.date_lim_reglement']['checked'])) print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'], $_SERVER['PHP_SELF'], "f.date_lim_reglement", '', $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['p.title']['checked'])) print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER['PHP_SELF'], "p.title", '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER['PHP_SELF'], 's.nom', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "f.fk_mode_reglement", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "f.fk_cond_reglement", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.module_source']['checked'])) print_liste_field_titre($arrayfields['f.module_source']['label'], $_SERVER["PHP_SELF"], "f.module_source", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.pos_source']['checked'])) print_liste_field_titre($arrayfields['f.pos_source']['label'], $_SERVER["PHP_SELF"], "f.pos_source", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], 'f.total', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'], $_SERVER['PHP_SELF'], 'f.tva', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.total_localtax2']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax2']['label'], $_SERVER['PHP_SELF'], 'f.localtax2', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.total_ttc', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.retained_warranty']['checked'])) print_liste_field_titre($arrayfields['f.retained_warranty']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.multicurrency_code']['checked'])) print_liste_field_titre($arrayfields['f.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_code', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.multicurrency_tx']['checked'])) print_liste_field_titre($arrayfields['f.multicurrency_tx']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_tx', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) print_liste_field_titre($arrayfields['f.multicurrency_total_ht']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_ht', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.multicurrency_total_vat']['checked'])) print_liste_field_titre($arrayfields['f.multicurrency_total_vat']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_tva', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.multicurrency_total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_ttc', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['multicurrency_dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['multicurrency_rtp']['checked'])) print_liste_field_titre($arrayfields['multicurrency_rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
@ -994,6 +1072,11 @@ if ($resql)
|
||||
$facturestatic->total_ht = $obj->total_ht;
|
||||
$facturestatic->total_tva = $obj->total_vat;
|
||||
$facturestatic->total_ttc = $obj->total_ttc;
|
||||
$facturestatic->multicurrency_code = $obj->multicurrency_code;
|
||||
$facturestatic->multicurrency_tx = $obj->multicurrency_tx;
|
||||
$facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
|
||||
$facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
|
||||
$facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
|
||||
$facturestatic->statut = $obj->fk_statut;
|
||||
$facturestatic->close_code = $obj->close_code;
|
||||
$facturestatic->total_ttc = $obj->total_ttc;
|
||||
@ -1031,14 +1114,23 @@ if ($resql)
|
||||
$totaldeposits = $facturestatic->getSumDepositsUsed();
|
||||
$totalpay = $paiement + $totalcreditnotes + $totaldeposits;
|
||||
$remaintopay = price2num($facturestatic->total_ttc - $totalpay);
|
||||
$multicurrency_paiement = $facturestatic->getSommePaiement(1);
|
||||
$multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
|
||||
$multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
|
||||
$multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
|
||||
$multicurrency_remaintopay = price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
|
||||
|
||||
if ($facturestatic->statut == Facture::STATUS_CLOSED && $facturestatic->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment
|
||||
$remaintopay = 0;
|
||||
$multicurrency_remaintopay = 0;
|
||||
}
|
||||
if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) { // If credit note closed, we take into account the amount not yet consummed
|
||||
$remaincreditnote = $discount->getAvailableDiscounts($obj->fk_soc, '', 'rc.fk_facture_source='.$facturestatic->id);
|
||||
$remaincreditnote = $discount->getAvailableDiscounts($thirdpartystatic, '', 'rc.fk_facture_source='.$facturestatic->id);
|
||||
$remaintopay = -$remaincreditnote;
|
||||
$totalpay = price2num($facturestatic->total_ttc - $remaintopay);
|
||||
$multicurrency_remaincreditnote = $discount->getAvailableDiscounts($thirdpartystatic, '', 'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
|
||||
$multicurrency_remaintopay = -$multicurrency_remaincreditnote;
|
||||
$multicurrency_totalpay = price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
|
||||
}
|
||||
|
||||
$facturestatic->alreadypaid = $paiement;
|
||||
@ -1306,6 +1398,55 @@ if ($resql)
|
||||
$totalarray['val']['rtp'] += $remaintopay;
|
||||
}
|
||||
|
||||
|
||||
// Currency
|
||||
if (!empty($arrayfields['f.multicurrency_code']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code . ' - ' . $langs->trans('Currency' . $obj->multicurrency_code)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Currency rate
|
||||
if (!empty($arrayfields['f.multicurrency_tx']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Amount HT
|
||||
if (!empty($arrayfields['f.multicurrency_total_ht']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.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 nowrap">'.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 nowrap">'.price($obj->multicurrency_total_ttc)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['multicurrency_dynamount_payed']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.(!empty($multicurrency_totalpay) ?price($multicurrency_totalpay, 0, $langs) : ' ').'</td>'; // TODO Use a denormalized field
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Pending amount
|
||||
if (!empty($arrayfields['multicurrency_rtp']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">';
|
||||
print (!empty($multicurrency_remaintopay) ? price($multicurrency_remaintopay, 0, $langs) : ' ');
|
||||
print '</td>'; // TODO Use a denormalized field
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
|
||||
@ -225,7 +225,6 @@ class Contrat extends CommonObject
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
||||
'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed')),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
||||
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||
@ -239,6 +238,7 @@ class Contrat extends CommonObject
|
||||
'ref_customer' =>array('type'=>'varchar(50)', 'label'=>'Ref customer', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
|
||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
|
||||
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed'))
|
||||
);
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
@ -517,7 +517,7 @@ class Contrat extends CommonObject
|
||||
{
|
||||
$num = $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
if ($num)
|
||||
{
|
||||
|
||||
@ -209,10 +209,10 @@ if (!empty($conf->use_javascript_ajax))
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setWidth('100%');
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphstatus');
|
||||
print $dolgraph->show($total ? 0 : 1);
|
||||
|
||||
@ -363,10 +363,10 @@ if ($result)
|
||||
print '</td>';
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->tms), 'dayhour').'</td>';
|
||||
//print '<td class="left">'.$staticcontrat->LibStatut($obj->statut,2).'</td>';
|
||||
print '<td class="right" width="32">'.($obj->nb_initial > 0 ? $obj->nb_initial.$staticcontratligne->LibStatut(0, 3) : '').'</td>';
|
||||
print '<td class="right" width="32">'.($obj->nb_running > 0 ? $obj->nb_running.$staticcontratligne->LibStatut(4, 3, 0) : '').'</td>';
|
||||
print '<td class="right" width="32">'.($obj->nb_expired > 0 ? $obj->nb_expired.$staticcontratligne->LibStatut(4, 3, 1) : '').'</td>';
|
||||
print '<td class="right" width="32">'.($obj->nb_closed > 0 ? $obj->nb_closed.$staticcontratligne->LibStatut(5, 3) : '').'</td>';
|
||||
print '<td class="right nowraponall" width="32">'.($obj->nb_initial > 0 ? '<span class="paddingright">'.$obj->nb_initial.'</span>'.$staticcontratligne->LibStatut(0, 3, -1, 'class="paddingleft"') : '').'</td>';
|
||||
print '<td class="right nowraponall" width="32">'.($obj->nb_running > 0 ? '<span class="paddingright">'.$obj->nb_running.'</span>'.$staticcontratligne->LibStatut(4, 3, 0, 'class="marginleft"') : '').'</td>';
|
||||
print '<td class="right nowraponall" width="32">'.($obj->nb_expired > 0 ? '<span class="paddingright">'.$obj->nb_expired.'</span>'.$staticcontratligne->LibStatut(4, 3, 1, 'class="paddingleft"') : '').'</td>';
|
||||
print '<td class="right nowraponall" width="32">'.($obj->nb_closed > 0 ? '<span class="paddingright">'.$obj->nb_closed.'</span>'.$staticcontratligne->LibStatut(5, 3, -1, 'class="paddingleft"') : '').'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -705,9 +705,7 @@ while ($i < min($num, $limit))
|
||||
$nbofsalesrepresentative = count($listsalesrepresentatives);
|
||||
if ($nbofsalesrepresentative > 3) {
|
||||
// We print only number
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$socstatic->id.'">';
|
||||
print $nbofsalesrepresentative;
|
||||
print '</a>';
|
||||
}
|
||||
elseif ($nbofsalesrepresentative > 0)
|
||||
{
|
||||
|
||||
@ -184,7 +184,7 @@ if ($action == 'add')
|
||||
GETPOST('langfile', 'alpha'),
|
||||
1,
|
||||
(GETPOST('totalizable', 'alpha')?1:0),
|
||||
(GETPOST('printable', 'alpha')?1:0)
|
||||
GETPOST('printable', 'alpha')
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -354,7 +354,7 @@ if ($action == 'update')
|
||||
GETPOST('langfile'),
|
||||
1,
|
||||
(GETPOST('totalizable', 'alpha')?1:0),
|
||||
(GETPOST('printable', 'alpha')?1:0)
|
||||
GETPOST('printable', 'alpha')
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
|
||||
@ -691,11 +691,11 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
|
||||
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
|
||||
$desc = ($lines[$i]->desc ? $lines[$i]->desc : '');
|
||||
// If we build one invoice for several order, we must put the invoice of order on the line
|
||||
if (!empty($createbills_onebythird))
|
||||
{
|
||||
$desc = dol_concatdesc($desc, $langs->trans("Order").' '.$cmd->ref.' - '.dol_print_date($cmd->date, 'day', $langs));
|
||||
$desc = dol_concatdesc($desc, $langs->trans("Order").' '.$cmd->ref.' - '.dol_print_date($cmd->date, 'day'));
|
||||
}
|
||||
|
||||
if ($lines[$i]->subprice < 0)
|
||||
|
||||
@ -72,6 +72,7 @@ class box_commandes extends ModeleBoxes
|
||||
public function loadBox($max = 5)
|
||||
{
|
||||
global $user, $langs, $conf;
|
||||
$langs->load('orders');
|
||||
|
||||
$this->max = $max;
|
||||
|
||||
|
||||
@ -160,6 +160,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
$px1->SetLegend($legend);
|
||||
$px1->SetMaxValue($px1->GetCeilMaxValue());
|
||||
$px1->SetWidth($WIDTH);
|
||||
|
||||
@ -75,6 +75,7 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$this->max = $max;
|
||||
$dir = $conf->user->dir_temp;
|
||||
|
||||
$refreshaction = 'refresh_'.$this->boxcode;
|
||||
|
||||
@ -145,7 +146,8 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
$showpointvalue = 1; $nocolor = 0;
|
||||
$mode = 'customer';
|
||||
$stats_invoice = new FactureStats($this->db, $socid, $mode, ($userid > 0 ? $userid : 0));
|
||||
$data1 = $stats_invoice->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)));
|
||||
$data1 = $stats_invoice->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), 5);
|
||||
|
||||
if (empty($data1))
|
||||
{
|
||||
$showpointvalue = 0;
|
||||
@ -159,11 +161,12 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
$mesg = $px1->isGraphKo();
|
||||
if (!$mesg)
|
||||
{
|
||||
$i = 0; $tot = count($data1); $legend = array();
|
||||
while ($i <= $tot)
|
||||
$i = 0; $legend = array();
|
||||
|
||||
foreach($data1 as $key => $val)
|
||||
{
|
||||
$data1[$i][0] = dol_trunc($data1[$i][0], 5); // Required to avoid error "Could not draw pie with labels contained inside canvas"
|
||||
$legend[] = $data1[$i][0];
|
||||
$data1[$key][0] = dol_trunc($data1[$key][0], 32);
|
||||
$legend[] = $data1[$key][0];
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -172,11 +175,11 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
|
||||
if ($nocolor) $px1->SetDataColor(array(array(220, 220, 220)));
|
||||
$px1->SetLegend($legend);
|
||||
$px1->setShowLegend(0);
|
||||
$px1->setShowLegend(2);
|
||||
$px1->setShowPointValue($showpointvalue);
|
||||
$px1->setShowPercent(0);
|
||||
$px1->SetMaxValue($px1->GetCeilMaxValue());
|
||||
$px1->SetWidth($WIDTH);
|
||||
//$px1->SetWidth($WIDTH);
|
||||
$px1->SetHeight($HEIGHT);
|
||||
//$px1->SetYLabel($langs->trans("NumberOfBills"));
|
||||
$px1->SetShading(3);
|
||||
@ -202,7 +205,7 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
|
||||
$showpointvalue = 1; $nocolor = 0;
|
||||
$stats_proposal = new PropaleStats($this->db, $socid, ($userid > 0 ? $userid : 0));
|
||||
$data2 = $stats_proposal->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)));
|
||||
$data2 = $stats_proposal->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), 5);
|
||||
if (empty($data2))
|
||||
{
|
||||
$showpointvalue = 0;
|
||||
@ -217,11 +220,12 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
$mesg = $px2->isGraphKo();
|
||||
if (!$mesg)
|
||||
{
|
||||
$i = 0; $tot = count($data2); $legend = array();
|
||||
while ($i <= $tot)
|
||||
$i = 0; $legend = array();
|
||||
|
||||
foreach($data2 as $key => $val)
|
||||
{
|
||||
$data2[$i][0] = dol_trunc($data2[$i][0], 5); // Required to avoid error "Could not draw pie with labels contained inside canvas"
|
||||
$legend[] = $data2[$i][0];
|
||||
$data2[$key][0] = dol_trunc($data2[$key][0], 32);
|
||||
$legend[] = $data2[$key][0];
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -230,11 +234,11 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
|
||||
if ($nocolor) $px2->SetDataColor(array(array(220, 220, 220)));
|
||||
$px2->SetLegend($legend);
|
||||
$px2->setShowLegend(0);
|
||||
$px2->setShowLegend(2);
|
||||
$px2->setShowPointValue($showpointvalue);
|
||||
$px2->setShowPercent(0);
|
||||
$px2->SetMaxValue($px2->GetCeilMaxValue());
|
||||
$px2->SetWidth($WIDTH);
|
||||
//$px2->SetWidth($WIDTH);
|
||||
$px2->SetHeight($HEIGHT);
|
||||
//$px2->SetYLabel($langs->trans("AmountOfBillsHT"));
|
||||
$px2->SetShading(3);
|
||||
@ -261,7 +265,7 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
$showpointvalue = 1; $nocolor = 0;
|
||||
$mode = 'customer';
|
||||
$stats_order = new CommandeStats($this->db, $socid, $mode, ($userid > 0 ? $userid : 0));
|
||||
$data3 = $stats_order->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)));
|
||||
$data3 = $stats_order->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), 5);
|
||||
if (empty($data3))
|
||||
{
|
||||
$showpointvalue = 0;
|
||||
@ -276,11 +280,12 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
$mesg = $px3->isGraphKo();
|
||||
if (!$mesg)
|
||||
{
|
||||
$i = 0; $tot = count($data3); $legend = array();
|
||||
while ($i <= $tot)
|
||||
$i = 0; $legend = array();
|
||||
|
||||
foreach($data3 as $key => $val)
|
||||
{
|
||||
$data3[$i][0] = dol_trunc($data3[$i][0], 5); // Required to avoid error "Could not draw pie with labels contained inside canvas"
|
||||
$legend[] = $data3[$i][0];
|
||||
$data3[$key][0] = dol_trunc($data3[$key][0], 32);
|
||||
$legend[] = $data3[$key][0];
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -289,11 +294,11 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
|
||||
if ($nocolor) $px3->SetDataColor(array(array(220, 220, 220)));
|
||||
$px3->SetLegend($legend);
|
||||
$px3->setShowLegend(0);
|
||||
$px3->setShowLegend(2);
|
||||
$px3->setShowPointValue($showpointvalue);
|
||||
$px3->setShowPercent(0);
|
||||
$px3->SetMaxValue($px3->GetCeilMaxValue());
|
||||
$px3->SetWidth($WIDTH);
|
||||
//$px3->SetWidth($WIDTH);
|
||||
$px3->SetHeight($HEIGHT);
|
||||
//$px3->SetYLabel($langs->trans("AmountOfBillsHT"));
|
||||
$px3->SetShading(3);
|
||||
|
||||
@ -176,6 +176,7 @@ class Canvas
|
||||
global $db, $conf, $langs, $user, $canvas;
|
||||
global $form, $formfile;
|
||||
|
||||
//var_dump($this->card.'-'.$action);
|
||||
include $this->template_dir.(!empty($this->card)?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php'; // Include native PHP template
|
||||
}
|
||||
|
||||
|
||||
@ -568,12 +568,12 @@ abstract class CommonDocGenerator
|
||||
'line_price_ttc_locale'=>price($line->total_ttc, 0, $outputlangs),
|
||||
'line_price_vat_locale'=>price($line->total_tva, 0, $outputlangs),
|
||||
// Dates
|
||||
'line_date_start'=>dol_print_date($line->date_start, 'day', 'tzuser'),
|
||||
'line_date_start_locale'=>dol_print_date($line->date_start, 'day', 'tzuser', $outputlangs),
|
||||
'line_date_start_rfc'=>dol_print_date($line->date_start, 'dayrfc', 'tzuser'),
|
||||
'line_date_end'=>dol_print_date($line->date_end, 'day', 'tzuser'),
|
||||
'line_date_end_locale'=>dol_print_date($line->date_end, 'day', 'tzuser', $outputlangs),
|
||||
'line_date_end_rfc'=>dol_print_date($line->date_end, 'dayrfc', 'tzuser'),
|
||||
'line_date_start'=>dol_print_date($line->date_start, 'day'),
|
||||
'line_date_start_locale'=>dol_print_date($line->date_start, 'day', 'tzserver', $outputlangs),
|
||||
'line_date_start_rfc'=>dol_print_date($line->date_start, 'dayrfc'),
|
||||
'line_date_end'=>dol_print_date($line->date_end, 'day'),
|
||||
'line_date_end_locale'=>dol_print_date($line->date_end, 'day', 'tzserver', $outputlangs),
|
||||
'line_date_end_rfc'=>dol_print_date($line->date_end, 'dayrfc'),
|
||||
|
||||
'line_multicurrency_code' => price2num($line->multicurrency_code),
|
||||
'line_multicurrency_subprice' => price2num($line->multicurrency_subprice),
|
||||
@ -609,21 +609,32 @@ abstract class CommonDocGenerator
|
||||
// Add the product supplier extrafields to the substitutions
|
||||
$extrafields->fetch_name_optionals_label("product_fournisseur_price");
|
||||
$extralabels=$extrafields->attributes["product_fournisseur_price"]['label'];
|
||||
$columns = "";
|
||||
foreach ($extralabels as $key => $value)
|
||||
$columns .= "$key, ";
|
||||
|
||||
if ($columns != "")
|
||||
{
|
||||
$columns = substr($columns, 0, strlen($columns) - 2);
|
||||
$resql = $this->db->query("SELECT $columns FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields AS ex INNER JOIN " . MAIN_DB_PREFIX . "product_fournisseur_price AS f ON ex.fk_object = f.rowid WHERE f.ref_fourn = '" . $line->ref_supplier . "'");
|
||||
if ($this->db->num_rows($resql) > 0) {
|
||||
$resql = $this->db->fetch_object($resql);
|
||||
if (!empty($extralabels) && is_array($extralabels))
|
||||
{
|
||||
$columns = "";
|
||||
|
||||
foreach ($extralabels as $key => $value)
|
||||
$resarray['line_product_supplier_'.$key] = $resql->{$key};
|
||||
}
|
||||
}
|
||||
foreach ($extralabels as $key)
|
||||
{
|
||||
$columns .= "$key, ";
|
||||
}
|
||||
|
||||
if ($columns != "")
|
||||
{
|
||||
$columns = substr($columns, 0, strlen($columns) - 2);
|
||||
$resql = $this->db->query("SELECT $columns FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields AS ex INNER JOIN " . MAIN_DB_PREFIX . "product_fournisseur_price AS f ON ex.fk_object = f.rowid WHERE f.ref_fourn = '" . $line->ref_supplier . "'");
|
||||
|
||||
if ($this->db->num_rows($resql) > 0)
|
||||
{
|
||||
$resql = $this->db->fetch_object($resql);
|
||||
|
||||
foreach ($extralabels as $key)
|
||||
{
|
||||
$resarray['line_product_supplier_'.$key] = $resql->{$key};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load product data optional fields to the line -> enables to use "line_options_{extrafield}"
|
||||
@ -1079,7 +1090,7 @@ abstract class CommonDocGenerator
|
||||
/**
|
||||
* print standard column content
|
||||
*
|
||||
* @param PDF $pdf pdf object
|
||||
* @param TCPDF $pdf pdf object
|
||||
* @param float $curY curent Y position
|
||||
* @param string $colKey the column key
|
||||
* @param string $columnText column text
|
||||
@ -1099,9 +1110,59 @@ abstract class CommonDocGenerator
|
||||
if (!$reshook)
|
||||
{
|
||||
if (empty($columnText)) return;
|
||||
$pdf->SetXY($this->getColumnContentXStart($colKey) - 1, $curY); // Set curent position
|
||||
$pdf->SetXY($this->getColumnContentXStart($colKey), $curY); // Set curent position
|
||||
$colDef = $this->cols[$colKey];
|
||||
$pdf->writeHTMLCell($this->getColumnContentWidth($colKey) + 2, 2, $this->getColumnContentXStart($colKey) - 1, $curY, $columnText, 0, 0, 0, true, $colDef['content']['align']);
|
||||
// save curent cell padding
|
||||
$curentCellPaddinds = $pdf->getCellPaddings();
|
||||
// set cell padding with column content definition
|
||||
$pdf->setCellPaddings($colDef['content']['padding'][3], $colDef['content']['padding'][0], $colDef['content']['padding'][1], $colDef['content']['padding'][2]);
|
||||
$pdf->writeHTMLCell($colDef['width'], 2, $colDef['xStartPos'], $curY, $columnText, 0, 1, 0, true, $colDef['content']['align']);
|
||||
|
||||
// restore cell padding
|
||||
$pdf->setCellPaddings($curentCellPaddinds['L'], $curentCellPaddinds['T'], $curentCellPaddinds['R'], $curentCellPaddinds['B']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* print description column content
|
||||
*
|
||||
* @param TCPDF $pdf pdf object
|
||||
* @param float $curY curent Y position
|
||||
* @param string $colKey the column key
|
||||
* @param object $object CommonObject
|
||||
* @param int $i the $object->lines array key
|
||||
* @param Translate $outputlangs Output language
|
||||
* @param int $hideref hide ref
|
||||
* @param int $hidedesc hide desc
|
||||
* @param int $issupplierline if object need supplier product
|
||||
* @return null
|
||||
*/
|
||||
public function printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
|
||||
{
|
||||
// load desc col params
|
||||
$colDef = $this->cols[$colKey];
|
||||
// save curent cell padding
|
||||
$curentCellPaddinds = $pdf->getCellPaddings();
|
||||
// set cell padding with column content definition
|
||||
$pdf->setCellPaddings($colDef['content']['padding'][3], $colDef['content']['padding'][0], $colDef['content']['padding'][1], $colDef['content']['padding'][2]);
|
||||
|
||||
// line description
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $colDef['width'], 3, $colDef['xStartPos'], $curY, $hideref, $hidedesc, $issupplierline);
|
||||
$posYAfterDescription = $pdf->GetY() - $colDef['content']['padding'][0];
|
||||
|
||||
// restore cell padding
|
||||
$pdf->setCellPaddings($curentCellPaddinds['L'], $curentCellPaddinds['T'], $curentCellPaddinds['R'], $curentCellPaddinds['B']);
|
||||
|
||||
// Display extrafield if needed
|
||||
$params = array(
|
||||
'display' => 'list',
|
||||
'printableEnable' => array(3),
|
||||
'printableEnableNotEmpty' => array(4)
|
||||
);
|
||||
$extrafieldDesc = $this->getExtrafieldsInHtml($object->lines[$i], $outputlangs, $params);
|
||||
if(!empty($extrafieldDesc)){
|
||||
$this->printStdColumnContent($pdf, $posYAfterDescription, $colKey, $extrafieldDesc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1184,6 +1245,8 @@ abstract class CommonDocGenerator
|
||||
$defaultParams = array(
|
||||
'style' => '',
|
||||
'display' => 'auto', // auto, table, list
|
||||
'printableEnable' => array(1),
|
||||
'printableEnableNotEmpty' => array(2),
|
||||
|
||||
'table' => array(
|
||||
'maxItemsInRow' => 2,
|
||||
@ -1218,7 +1281,18 @@ abstract class CommonDocGenerator
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label)
|
||||
{
|
||||
// Enable extrafield ?
|
||||
$enabled = !empty($extrafields->attributes[$object->table_element]['printable'][$key]);
|
||||
$enabled = 0;
|
||||
$disableOnEmpty = 0;
|
||||
if(!empty($extrafields->attributes[$object->table_element]['printable'][$key])) {
|
||||
$printable = intval($extrafields->attributes[$object->table_element]['printable'][$key]);
|
||||
if(in_array($printable, $params['printableEnable']) || in_array($printable, $params['printableEnableNotEmpty']) ) {
|
||||
$enabled = 1;
|
||||
}
|
||||
|
||||
if (in_array($printable, $params['printableEnableNotEmpty'])) {
|
||||
$disableOnEmpty = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($enabled)){
|
||||
continue;
|
||||
@ -1230,6 +1304,11 @@ abstract class CommonDocGenerator
|
||||
$field->label = $outputlangs->transnoentities($label);
|
||||
$field->type = $extrafields->attributes[$object->table_element]['type'][$key];
|
||||
|
||||
// dont display if empty
|
||||
if($disableOnEmpty && empty($field->content)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fields[] = $field;
|
||||
}
|
||||
}
|
||||
@ -1239,13 +1318,10 @@ abstract class CommonDocGenerator
|
||||
// Sort extrafields by rank
|
||||
uasort($fields, function ($a, $b) {
|
||||
return ($a->rank > $b->rank) ? -1 : 1;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
});
|
||||
|
||||
// define some HTML content with style
|
||||
$html.= '<style>'.$params['style'].'</style>';
|
||||
$html.= !empty($params['style'])?'<style>'.$params['style'].'</style>':'';
|
||||
|
||||
// auto select display format
|
||||
if($params['display'] == 'auto') {
|
||||
@ -1260,10 +1336,12 @@ abstract class CommonDocGenerator
|
||||
|
||||
if($params['display'] == 'list') {
|
||||
// Display in list format
|
||||
$i=0;
|
||||
foreach ($fields as $field) {
|
||||
$html .= !empty($html)?$params['list']['separator']:'';
|
||||
$html .= !empty($i)?$params['list']['separator']:'';
|
||||
$html .= '<strong>' . $field->label . ' : </strong>';
|
||||
$html .= $field->content;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
elseif($params['display'] == 'table') {
|
||||
@ -1338,7 +1416,7 @@ abstract class CommonDocGenerator
|
||||
/**
|
||||
* Print standard column content
|
||||
*
|
||||
* @param PDF $pdf Pdf object
|
||||
* @param TCPDI $pdf Pdf object
|
||||
* @param float $tab_top Tab top position
|
||||
* @param float $tab_height Default tab height
|
||||
* @param Translate $outputlangs Output language
|
||||
@ -1374,18 +1452,35 @@ abstract class CommonDocGenerator
|
||||
}
|
||||
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
|
||||
$textWidth = $colDef['width'] - $colDef['title']['padding'][3] - $colDef['title']['padding'][1];
|
||||
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
|
||||
// save curent cell padding
|
||||
$curentCellPaddinds = $pdf->getCellPaddings();
|
||||
|
||||
global $outputlangsbis;
|
||||
if (is_object($outputlangsbis)) {
|
||||
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0] + 4);
|
||||
// set cell padding with column title definition
|
||||
$pdf->setCellPaddings($colDef['title']['padding'][3], $colDef['title']['padding'][0], $colDef['title']['padding'][1], 0.5);
|
||||
}
|
||||
else{
|
||||
// set cell padding with column title definition
|
||||
$pdf->setCellPaddings($colDef['title']['padding'][3], $colDef['title']['padding'][0], $colDef['title']['padding'][1], $colDef['title']['padding'][2]);
|
||||
}
|
||||
|
||||
$pdf->SetXY($colDef['xStartPos'], $tab_top);
|
||||
$textWidth = $colDef['width'];
|
||||
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
|
||||
|
||||
|
||||
if (is_object($outputlangsbis)) {
|
||||
$pdf->setCellPaddings($colDef['title']['padding'][3], 0, $colDef['title']['padding'][1], $colDef['title']['padding'][2]);
|
||||
$pdf->SetXY($colDef['xStartPos'], $pdf->GetY());
|
||||
$textbis = $outputlangsbis->transnoentities($colDef['title']['textkey']);
|
||||
$pdf->MultiCell($textWidth, 2, $textbis, '', $colDef['title']['align']);
|
||||
}
|
||||
|
||||
$this->tabTitleHeight = max($pdf->GetY() - $tab_top + $colDef['title']['padding'][2], $this->tabTitleHeight);
|
||||
$this->tabTitleHeight = max($pdf->GetY() - $tab_top, $this->tabTitleHeight);
|
||||
|
||||
// restore cell padding
|
||||
$pdf->setCellPaddings($curentCellPaddinds['L'], $curentCellPaddinds['T'], $curentCellPaddinds['R'], $curentCellPaddinds['B']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1430,8 +1525,16 @@ abstract class CommonDocGenerator
|
||||
}
|
||||
|
||||
// Enable extrafield ?
|
||||
$enabled = !empty($extrafields->attributes[$object->table_element]['printable'][$key]);
|
||||
$enabled = 0;
|
||||
if(!empty($extrafields->attributes[$object->table_element]['printable'][$key])) {
|
||||
$printable = intval($extrafields->attributes[$object->table_element]['printable'][$key]);
|
||||
if($printable === 1 || $printable === 2) {
|
||||
$enabled = 1;
|
||||
}
|
||||
// Note : if $printable === 3 or 4 so, it's displayed after line description not in cols
|
||||
}
|
||||
|
||||
if (!$enabled){ continue; } // don't wast resourses if we don't need them...
|
||||
|
||||
// Load language if required
|
||||
if (!empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $outputlangs->load($extrafields->attributes[$object->table_element]['langfile'][$key]);
|
||||
|
||||
@ -5420,7 +5420,7 @@ abstract class CommonObject
|
||||
// Add field of attribute
|
||||
if ($extrafields->attributes[$this->table_element]['type'][$attributeKey] != 'separate') // Only for other type than separator)
|
||||
{
|
||||
if ($new_array_options[$key] != '')
|
||||
if ($new_array_options[$key] != '' || $new_array_options[$key] == '0')
|
||||
{
|
||||
$sql .= ",'".$this->db->escape($new_array_options[$key])."'";
|
||||
}
|
||||
@ -5522,7 +5522,7 @@ abstract class CommonObject
|
||||
$this->errors[] = $langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
|
||||
return -1;
|
||||
}
|
||||
elseif ($value == '')
|
||||
elseif ($value === '')
|
||||
{
|
||||
$this->array_options["options_".$key] = null;
|
||||
}
|
||||
@ -5535,7 +5535,7 @@ abstract class CommonObject
|
||||
$this->errors[] = $langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
|
||||
return -1;
|
||||
}
|
||||
elseif ($value == '')
|
||||
elseif ($value === '')
|
||||
{
|
||||
$this->array_options["options_".$key] = null;
|
||||
}
|
||||
@ -6798,7 +6798,8 @@ abstract class CommonObject
|
||||
if ($mode != 'view' && !empty($extrafields->attributes[$this->table_element]['required'][$key])) $out .= ' <font color="red">*</font>';
|
||||
} else {
|
||||
if ($mode != 'view' && !empty($extrafields->attributes[$this->table_element]['required'][$key])) $out .= ' fieldrequired';
|
||||
$out .= '">';
|
||||
$out .= '"';
|
||||
$out .= '>';
|
||||
if (!empty($extrafields->attributes[$this->table_element]['help'][$key])) $out .= $form->textwithpicto($labeltoshow, $extrafields->attributes[$this->table_element]['help'][$key]);
|
||||
else $out .= $labeltoshow;
|
||||
}
|
||||
|
||||
@ -683,6 +683,8 @@ class Conf
|
||||
|
||||
if (!isset($this->global->MAIN_USE_OLD_TITLE_BUTTON)) $this->global->MAIN_USE_OLD_TITLE_BUTTON = 0;
|
||||
|
||||
if (!isset($this->global->MAIN_JS_GRAPH)) $this->global->MAIN_JS_GRAPH = 'chart'; // Use chart.js library
|
||||
|
||||
if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV = 'https://www.dolistore.com';
|
||||
if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY = 'dolistorecatalogpublickey1234567';
|
||||
|
||||
|
||||
@ -504,15 +504,16 @@ class DiscountAbsolute
|
||||
* @param string $filter Filtre autre
|
||||
* @param int $maxvalue Filter on max value for discount
|
||||
* @param int $discount_type 0 => customer discount, 1 => supplier discount
|
||||
* @param int $multicurrency Return multicurrency_amount instead of amount
|
||||
* @return int <0 if KO, amount otherwise
|
||||
*/
|
||||
public function getAvailableDiscounts($company = '', $user = '', $filter = '', $maxvalue = 0, $discount_type = 0)
|
||||
public function getAvailableDiscounts($company = '', $user = '', $filter = '', $maxvalue = 0, $discount_type = 0, $multicurrency = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(get_class($this)."::getAvailableDiscounts discount_type=".$discount_type, LOG_DEBUG);
|
||||
|
||||
$sql = "SELECT SUM(rc.amount_ttc) as amount";
|
||||
$sql = "SELECT SUM(rc.amount_ttc) as amount, SUM(rc.multicurrency_amount_ttc) as multicurrency_amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc";
|
||||
$sql .= " WHERE rc.entity = ".$conf->entity;
|
||||
$sql .= " AND rc.discount_type=".intval($discount_type);
|
||||
@ -535,6 +536,11 @@ class DiscountAbsolute
|
||||
//print 'zz'.$obj->amount;
|
||||
//$obj = $this->db->fetch_object($resql);
|
||||
//}
|
||||
if ($multicurrency)
|
||||
{
|
||||
return $obj->amount_multicurrency;
|
||||
}
|
||||
|
||||
return $obj->amount;
|
||||
}
|
||||
return -1;
|
||||
|
||||
@ -30,10 +30,10 @@
|
||||
* $dolgraph->SetTitle($langs->transnoentities('MyTitle').'<br>'.$langs->transnoentities('MyTitlePercent').'%');
|
||||
* $dolgraph->SetMaxValue(50);
|
||||
* $dolgraph->SetData($data);
|
||||
* $dolgraph->setShowLegend(1);
|
||||
* $dolgraph->setShowLegend(2);
|
||||
* $dolgraph->setShowPercent(1);
|
||||
* $dolgraph->SetType(array('pie'));
|
||||
* $dolgraph->setWidth('100%');
|
||||
* $dolgraph->setHeight('200');
|
||||
* $dolgraph->draw('idofgraph');
|
||||
* print $dolgraph->show($total?0:1);
|
||||
*/
|
||||
@ -92,31 +92,13 @@ class DolGraph
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $library 'jflot' (default) or 'artichow' (no more supported)
|
||||
* @param string $library 'auto' (default)
|
||||
*/
|
||||
public function __construct($library = 'jflot')
|
||||
public function __construct($library = 'auto')
|
||||
{
|
||||
global $conf;
|
||||
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor;
|
||||
|
||||
// To use old feature
|
||||
if ($library == 'artichow')
|
||||
{
|
||||
$this->_library = 'artichow';
|
||||
|
||||
// Test if module GD present
|
||||
$modules_list = get_loaded_extensions();
|
||||
$isgdinstalled = 0;
|
||||
foreach ($modules_list as $module)
|
||||
{
|
||||
if ($module == 'gd') $isgdinstalled = 1;
|
||||
}
|
||||
if (!$isgdinstalled)
|
||||
{
|
||||
$this->error = "Error: PHP GD module is not available. It is required to build graphics.";
|
||||
}
|
||||
}
|
||||
|
||||
$this->bordercolor = array(235, 235, 224);
|
||||
$this->datacolor = array(array(120, 130, 150), array(160, 160, 180), array(190, 190, 220));
|
||||
$this->bgcolor = array(235, 235, 224);
|
||||
@ -130,23 +112,14 @@ class DolGraph
|
||||
if (isset($theme_bgcolor)) $this->bgcolor = $theme_bgcolor;
|
||||
}
|
||||
//print 'bgcolor: '.join(',',$this->bgcolor).'<br>';
|
||||
|
||||
$this->_library = $library;
|
||||
if ($this->_library == 'auto') {
|
||||
$this->_library = (empty($conf->global->MAIN_JS_GRAPH) ? 'jflot': $conf->global->MAIN_JS_GRAPH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Set Y precision
|
||||
*
|
||||
* @param float $which_prec Precision
|
||||
* @return boolean
|
||||
* @deprecated
|
||||
*/
|
||||
public function SetPrecisionY($which_prec)
|
||||
{
|
||||
// phpcs:enable
|
||||
return true;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Utiliser SetNumTicks ou SetHorizTickIncrement mais pas les 2
|
||||
@ -287,7 +260,8 @@ class DolGraph
|
||||
/**
|
||||
* Set type
|
||||
*
|
||||
* @param array $type Array with type for each serie. Example: array('pie'), array('lines',...,'bars')
|
||||
* @param array $type Array with type for each serie. Example: array('type1', 'type2', ...) where type can be:
|
||||
* 'pie', 'piesemicircle', 'polar', 'lines', 'linesnopoint', 'bars', ...
|
||||
* @return void
|
||||
*/
|
||||
public function SetType($type)
|
||||
@ -448,7 +422,7 @@ class DolGraph
|
||||
/**
|
||||
* Show legend or not
|
||||
*
|
||||
* @param int $showlegend 1=Show legend (default), 0=Hide legend
|
||||
* @param int $showlegend 1=Show legend (default), 0=Hide legend, 2=Show legend on right
|
||||
* @return void
|
||||
*/
|
||||
public function setShowLegend($showlegend)
|
||||
@ -561,6 +535,8 @@ class DolGraph
|
||||
public function GetMaxValueInData()
|
||||
{
|
||||
// phpcs:enable
|
||||
if (! is_array($this->data)) return 0;
|
||||
|
||||
$k = 0;
|
||||
$vals = array();
|
||||
|
||||
@ -588,6 +564,8 @@ class DolGraph
|
||||
public function GetMinValueInData()
|
||||
{
|
||||
// phpcs:enable
|
||||
if (! is_array($this->data)) return 0;
|
||||
|
||||
$k = 0;
|
||||
$vals = array();
|
||||
|
||||
@ -686,188 +664,6 @@ class DolGraph
|
||||
call_user_func_array(array($this, $call), array($file, $fileurl));
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Build a graph onto disk using Artichow library and return img string to it
|
||||
*
|
||||
* @param string $file Image file name to use if we save onto disk
|
||||
* @param string $fileurl Url path to show image if saved onto disk
|
||||
* @return void
|
||||
*/
|
||||
private function draw_artichow($file, $fileurl)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $artichow_defaultfont;
|
||||
|
||||
dol_syslog(get_class($this)."::draw_artichow this->type=".join(',', $this->type));
|
||||
|
||||
if (!defined('SHADOW_RIGHT_TOP')) define('SHADOW_RIGHT_TOP', 3);
|
||||
if (!defined('LEGEND_BACKGROUND')) define('LEGEND_BACKGROUND', 2);
|
||||
if (!defined('LEGEND_LINE')) define('LEGEND_LINE', 1);
|
||||
|
||||
// Create graph
|
||||
$classname = '';
|
||||
if (!isset($this->type[0]) || $this->type[0] == 'bars') $classname = 'BarPlot'; // Only one type (first one) is supported by artichow
|
||||
elseif ($this->type[0] == 'lines' || $this->type[0] == 'linesnopoint') $classname = 'LinePlot';
|
||||
else $classname = 'TypeUnknown';
|
||||
include_once ARTICHOW_PATH.$classname.'.class.php';
|
||||
|
||||
// Definition de couleurs
|
||||
$bgcolor = new Color($this->bgcolor[0], $this->bgcolor[1], $this->bgcolor[2]);
|
||||
$bgcolorgrid = new Color($this->bgcolorgrid[0], $this->bgcolorgrid[1], $this->bgcolorgrid[2]);
|
||||
$colortrans = new Color(0, 0, 0, 100);
|
||||
$colorsemitrans = new Color(255, 255, 255, 60);
|
||||
$colorgradient = new LinearGradient(new Color(235, 235, 235), new Color(255, 255, 255), 0);
|
||||
$colorwhite = new Color(255, 255, 255);
|
||||
|
||||
// Graph
|
||||
$graph = new Graph($this->width, $this->height);
|
||||
$graph->border->hide();
|
||||
$graph->setAntiAliasing(true);
|
||||
if (isset($this->title))
|
||||
{
|
||||
$graph->title->set($this->title);
|
||||
//print $artichow_defaultfont;exit;
|
||||
$graph->title->setFont(new $artichow_defaultfont(10));
|
||||
}
|
||||
|
||||
if (is_array($this->bgcolor)) $graph->setBackgroundColor($bgcolor);
|
||||
else $graph->setBackgroundGradient($colorgradient);
|
||||
|
||||
$group = new PlotGroup;
|
||||
//$group->setSpace(5, 5, 0, 0);
|
||||
|
||||
$paddleft = 50;
|
||||
$paddright = 10;
|
||||
$strl = dol_strlen(max(abs($this->MaxValue), abs($this->MinValue)));
|
||||
if ($strl > 6) $paddleft += ($strl * 4);
|
||||
$group->setPadding($paddleft, $paddright); // Width on left and right for Y axis values
|
||||
$group->legend->setSpace(0);
|
||||
$group->legend->setPadding(2, 2, 2, 2);
|
||||
$group->legend->setPosition(null, 0.1);
|
||||
$group->legend->setBackgroundColor($colorsemitrans);
|
||||
|
||||
if (is_array($this->bgcolorgrid)) $group->grid->setBackgroundColor($bgcolorgrid);
|
||||
else $group->grid->setBackgroundColor($colortrans);
|
||||
|
||||
if ($this->hideXGrid) $group->grid->hideVertical(true);
|
||||
if ($this->hideYGrid) $group->grid->hideHorizontal(true);
|
||||
|
||||
// On boucle sur chaque lot de donnees
|
||||
$legends = array();
|
||||
$i = 0;
|
||||
$nblot = count($this->data[0]) - 1;
|
||||
|
||||
while ($i < $nblot)
|
||||
{
|
||||
$x = 0;
|
||||
$values = array();
|
||||
foreach ($this->data as $key => $valarray)
|
||||
{
|
||||
$legends[$x] = $valarray[0];
|
||||
$values[$x] = $valarray[$i + 1];
|
||||
$x++;
|
||||
}
|
||||
|
||||
// We fix unknown values to null
|
||||
$newvalues = array();
|
||||
foreach ($values as $val)
|
||||
{
|
||||
$newvalues[] = (is_numeric($val) ? $val : null);
|
||||
}
|
||||
|
||||
|
||||
if ($this->type[0] == 'bars')
|
||||
{
|
||||
//print "Lot de donnees $i<br>";
|
||||
//print_r($values);
|
||||
//print '<br>';
|
||||
|
||||
$color = new Color($this->datacolor[$i][0], $this->datacolor[$i][1], $this->datacolor[$i][2], 20);
|
||||
$colorbis = new Color(min($this->datacolor[$i][0] + 50, 255), min($this->datacolor[$i][1] + 50, 255), min($this->datacolor[$i][2] + 50, 255), 50);
|
||||
|
||||
$colorgrey = new Color(100, 100, 100);
|
||||
$colorborder = new Color($this->datacolor[$i][0], $this->datacolor[$i][1], $this->datacolor[$i][2]);
|
||||
|
||||
if ($this->mode == 'side') $plot = new BarPlot($newvalues, $i + 1, $nblot);
|
||||
if ($this->mode == 'depth') $plot = new BarPlot($newvalues, 1, 1, ($nblot - $i - 1) * 5);
|
||||
|
||||
$plot->barBorder->setColor($colorgrey);
|
||||
//$plot->setBarColor($color);
|
||||
$plot->setBarGradient(new LinearGradient($colorbis, $color, 90));
|
||||
|
||||
if ($this->mode == 'side') $plot->setBarPadding(0.1, 0.1);
|
||||
if ($this->mode == 'depth') $plot->setBarPadding(0.1, 0.4);
|
||||
if ($this->mode == 'side') $plot->setBarSpace(5);
|
||||
if ($this->mode == 'depth') $plot->setBarSpace(2);
|
||||
|
||||
$plot->barShadow->setSize($this->SetShading);
|
||||
$plot->barShadow->setPosition(SHADOW_RIGHT_TOP);
|
||||
$plot->barShadow->setColor(new Color(160, 160, 160, 50));
|
||||
$plot->barShadow->smooth(true);
|
||||
//$plot->setSize(1, 0.96);
|
||||
//$plot->setCenter(0.5, 0.52);
|
||||
|
||||
// Le mode automatique est plus efficace
|
||||
$plot->SetYMax($this->MaxValue);
|
||||
$plot->SetYMin($this->MinValue);
|
||||
}
|
||||
|
||||
if ($this->type[0] == 'lines' || $this->type[0] == 'linesnopoint')
|
||||
{
|
||||
$color = new Color($this->datacolor[$i][0], $this->datacolor[$i][1], $this->datacolor[$i][2], 20);
|
||||
$colorbis = new Color(min($this->datacolor[$i][0] + 20, 255), min($this->datacolor[$i][1] + 20, 255), min($this->datacolor[$i][2] + 20, 255), 60);
|
||||
$colorter = new Color(min($this->datacolor[$i][0] + 50, 255), min($this->datacolor[$i][1] + 50, 255), min($this->datacolor[$i][2] + 50, 255), 90);
|
||||
|
||||
$plot = new LinePlot($newvalues);
|
||||
//$plot->setSize(1, 0.96);
|
||||
//$plot->setCenter(0.5, 0.52);
|
||||
|
||||
$plot->setColor($color);
|
||||
$plot->setThickness(1);
|
||||
|
||||
// Set line background gradient
|
||||
$plot->setFillGradient(new LinearGradient($colorter, $colorbis, 90));
|
||||
|
||||
$plot->xAxis->setLabelText($legends);
|
||||
|
||||
// Le mode automatique est plus efficace
|
||||
$plot->SetYMax($this->MaxValue);
|
||||
$plot->SetYMin($this->MinValue);
|
||||
//$plot->setYAxis(0);
|
||||
//$plot->hideLine(true);
|
||||
}
|
||||
|
||||
//$plot->reduce(80); // Evite temps d'affichage trop long et nombre de ticks absisce satures
|
||||
|
||||
$group->legend->setTextFont(new $artichow_defaultfont(10)); // This is to force Artichow to use awFileFontDriver to
|
||||
// solve a bug in Artichow with UTF8
|
||||
if (count($this->Legend))
|
||||
{
|
||||
if ($this->type[0] == 'bars') $group->legend->add($plot, $this->Legend[$i], LEGEND_BACKGROUND);
|
||||
if ($this->type[0] == 'lines' || $this->type[0] == 'linesnopoint') $group->legend->add($plot, $this->Legend[$i], LEGEND_LINE);
|
||||
}
|
||||
$group->add($plot);
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$group->axis->bottom->setLabelText($legends);
|
||||
$group->axis->bottom->label->setFont(new $artichow_defaultfont(7));
|
||||
|
||||
//print $group->axis->bottom->getLabelNumber();
|
||||
if ($this->labelInterval > 0) $group->axis->bottom->setLabelInterval($this->labelInterval);
|
||||
|
||||
$graph->add($group);
|
||||
|
||||
// Generate file
|
||||
$graph->draw($file);
|
||||
|
||||
$this->stringtoshow = '<!-- Build using '.$this->_library.' --><img src="'.$fileurl.'" title="'.dol_escape_htmltag($this->title ? $this->title : $this->YLabel).'" alt="'.dol_escape_htmltag($this->title ? $this->title : $this->YLabel).'">';
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Build a graph using JFlot library. Input when calling this method should be:
|
||||
@ -875,7 +671,7 @@ class DolGraph
|
||||
* $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // or when there is n series to show for each x
|
||||
* $this->data = array(array('label'=>'labelxA','data'=>yA), array('labelxB',yB)); // Syntax deprecated
|
||||
* $this->legend= array("Val1",...,"Valn"); // list of n series name
|
||||
* $this->type = array('bars',...'lines'); or array('pie')
|
||||
* $this->type = array('bars',...'lines','linesnopoint'); or array('pie') or array('polar')
|
||||
* $this->mode = 'depth' ???
|
||||
* $this->bgcolorgrid
|
||||
* $this->datacolor
|
||||
@ -888,7 +684,7 @@ class DolGraph
|
||||
private function draw_jflot($file, $fileurl)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::draw_jflot this->type=".join(',', $this->type)." this->MaxValue=".$this->MaxValue);
|
||||
|
||||
@ -924,8 +720,7 @@ class DolGraph
|
||||
$x++;
|
||||
}
|
||||
|
||||
// TODO Avoid push by adding generated long array...
|
||||
if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'pie')
|
||||
if (isset($this->type[$firstlot]) && in_array($this->type[$firstlot], array('pie', 'piesemicircle', 'polar')))
|
||||
{
|
||||
foreach ($values as $x => $y) {
|
||||
if (isset($y)) $serie[$i] .= 'd'.$i.'.push({"label":"'.dol_escape_js($legends[$x]).'", "data":'.$y.'});'."\n";
|
||||
@ -943,7 +738,7 @@ class DolGraph
|
||||
}
|
||||
$tag = dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-', '.'))));
|
||||
|
||||
$this->stringtoshow = '<!-- Build using '.$this->_library.' -->'."\n";
|
||||
$this->stringtoshow = '<!-- Build using jflot -->'."\n";
|
||||
if (!empty($this->title)) $this->stringtoshow .= '<div class="center dolgraphtitle'.(empty($this->cssprefix) ? '' : ' dolgraphtitle'.$this->cssprefix).'">'.$this->title.'</div>';
|
||||
if (!empty($this->shownographyet))
|
||||
{
|
||||
@ -962,23 +757,27 @@ class DolGraph
|
||||
$i = $firstlot;
|
||||
if ($nblot < 0)
|
||||
{
|
||||
$this->stringtoshow .= '<!-- No series of data -->';
|
||||
$this->stringtoshow .= '<!-- No series of data -->'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
while ($i < $nblot)
|
||||
{
|
||||
$this->stringtoshow .= $serie[$i];
|
||||
$this->stringtoshow .= '<!-- Serie '.$i.' -->'."\n";
|
||||
$this->stringtoshow .= $serie[$i]."\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$this->stringtoshow .= "\n";
|
||||
|
||||
// Special case for Graph of type 'pie'
|
||||
if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'pie')
|
||||
if (isset($this->type[$firstlot]) && in_array($this->type[$firstlot], array('pie', 'piesemicircle', 'polar')))
|
||||
{
|
||||
$datacolor = array();
|
||||
foreach ($this->datacolor as $val) $datacolor[] = "#".sprintf("%02x%02x%02x", $val[0], $val[1], $val[2]);
|
||||
foreach ($this->datacolor as $val) {
|
||||
if (is_array($val)) $datacolor[] = "#".sprintf("%02x%02x%02x", $val[0], $val[1], $val[2]); // If datacolor is array(R, G, B)
|
||||
else $datacolor[] = "#".str_replace(array('#', '-'), '', $val); // If $val is '124' or '#124'
|
||||
}
|
||||
|
||||
$urltemp = ''; // TODO Add support for url link into labels
|
||||
$showlegend = $this->showlegend;
|
||||
@ -1131,6 +930,361 @@ class DolGraph
|
||||
$this->stringtoshow .= '</script>'."\n";
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Build a graph using Chart library. Input when calling this method should be:
|
||||
* $this->data = array(array(0=>'labelxA',1=>yA), array('labelxB',yB));
|
||||
* $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // or when there is n series to show for each x
|
||||
* $this->data = array(array('label'=>'labelxA','data'=>yA), array('labelxB',yB)); // Syntax deprecated
|
||||
* $this->legend= array("Val1",...,"Valn"); // list of n series name
|
||||
* $this->type = array('bars',...'lines', 'linesnopoint'); or array('pie') or array('polar') or array('piesemicircle');
|
||||
* $this->mode = 'depth' ???
|
||||
* $this->bgcolorgrid
|
||||
* $this->datacolor
|
||||
* $this->shownodatagraph
|
||||
*
|
||||
* @param string $file Image file name to use to save onto disk (also used as javascript unique id)
|
||||
* @param string $fileurl Url path to show image if saved onto disk. Never used here.
|
||||
* @return void
|
||||
*/
|
||||
private function draw_chart($file, $fileurl)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::draw_chart this->type=".join(',', $this->type)." this->MaxValue=".$this->MaxValue);
|
||||
|
||||
if (empty($this->width) && empty($this->height))
|
||||
{
|
||||
print 'Error width or height not set';
|
||||
return;
|
||||
}
|
||||
|
||||
$showlegend = $this->showlegend;
|
||||
|
||||
$legends = array();
|
||||
$nblot = 0;
|
||||
if (is_array($this->data)) {
|
||||
foreach ($this->data as $valarray) // Loop on each x
|
||||
{
|
||||
$nblot = max($nblot, count($valarray) - 1); // -1 to remove legend
|
||||
}
|
||||
}
|
||||
//var_dump($nblot);
|
||||
if ($nblot < 0) dol_syslog('Bad value for property ->data. Must be set by mydolgraph->SetData before calling mydolgrapgh->draw', LOG_WARNING);
|
||||
$firstlot = 0;
|
||||
// Works with line but not with bars
|
||||
//if ($nblot > 2) $firstlot = ($nblot - 2); // We limit nblot to 2 because jflot can't manage more than 2 bars on same x
|
||||
|
||||
$serie = array(); $arrayofgroupslegend = array();
|
||||
//var_dump($this->data);
|
||||
|
||||
$i = $firstlot;
|
||||
while ($i < $nblot) // Loop on each serie
|
||||
{
|
||||
$values = array(); // Array with horizontal y values (specific values of a serie) for each abscisse x (with x=0,1,2,...)
|
||||
$serie[$i] = "";
|
||||
|
||||
// Fill array $values
|
||||
$x = 0;
|
||||
foreach ($this->data as $valarray) // Loop on each x
|
||||
{
|
||||
$legends[$x] = (array_key_exists('label', $valarray) ? $valarray['label'] : $valarray[0]);
|
||||
$array_of_ykeys = array_keys($valarray);
|
||||
$alabelexists = 1;
|
||||
$tmpykey = explode('_', ($array_of_ykeys[$i+($alabelexists ? 1 : 0)]), 3);
|
||||
if (! empty($tmpykey[2]) || $tmpykey[2] == '0') { // This is a 'Group by' array
|
||||
$tmpvalue = (array_key_exists('y_'.$tmpykey[1].'_'.$tmpykey[2], $valarray) ? $valarray['y_'.$tmpykey[1].'_'.$tmpykey[2]] : $valarray[$i + 1]);
|
||||
$values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
|
||||
$arrayofgroupslegend[$i] = array(
|
||||
'stacknum'=> $tmpykey[1],
|
||||
'legend' => $this->Legend[$tmpykey[1]],
|
||||
'legendwithgroup' => $this->Legend[$tmpykey[1]].' - '.$tmpykey[2]
|
||||
);
|
||||
} else {
|
||||
$tmpvalue = (array_key_exists('y_'.$i, $valarray) ? $valarray['y_'.$i] : $valarray[$i + 1]);
|
||||
//var_dump($i.'_'.$x.'_'.$tmpvalue);
|
||||
$values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
//var_dump($values);
|
||||
$j = 0;
|
||||
foreach ($values as $x => $y) {
|
||||
if (isset($y)) {
|
||||
$serie[$i] .= ($j > 0 ? ", " : "").$y;
|
||||
} else {
|
||||
$serie[$i] .= ($j > 0 ? ", " : "").'null';
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
|
||||
$values = null; // Free mem
|
||||
$i++;
|
||||
}
|
||||
//var_dump($serie);
|
||||
//var_dump($arrayofgroupslegend);
|
||||
|
||||
$tag = dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-', '.'))));
|
||||
|
||||
$this->stringtoshow = '<!-- Build using chart -->'."\n";
|
||||
if (!empty($this->title)) $this->stringtoshow .= '<div class="center dolgraphtitle'.(empty($this->cssprefix) ? '' : ' dolgraphtitle'.$this->cssprefix).'">'.$this->title.'</div>';
|
||||
if (!empty($this->shownographyet))
|
||||
{
|
||||
$this->stringtoshow .= '<div style="width:'.$this->width.(strpos($this->width, '%') > 0 ? '': 'px').'; height:'.$this->height.'px;" class="nographyet"></div>';
|
||||
$this->stringtoshow .= '<div class="nographyettext">'.$langs->trans("NotEnoughDataYet").'</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
// Start the div that will contains all the graph
|
||||
$dolxaxisvertical='';
|
||||
if (count($this->data) > 20) $dolxaxisvertical='dol-xaxis-vertical';
|
||||
// No height for the pie grah
|
||||
$cssfordiv = 'dolgraphchart';
|
||||
if (isset($this->type[$firstlot])) $cssfordiv .= ' dolgraphchar'.$this->type[$firstlot];
|
||||
$this->stringtoshow .= '<div id="placeholder_'.$tag.'" style="min-height: '.$this->height.(strpos($this->height, '%') > 0 ? '': 'px').'; width:'.$this->width.(strpos($this->width, '%') > 0 ? '': 'px').';" class="'.$cssfordiv.' dolgraph'.(empty($dolxaxisvertical)?'':' '.$dolxaxisvertical).(empty($this->cssprefix) ? '' : ' dolgraph'.$this->cssprefix).' center"><canvas id="canvas_'.$tag.'"></canvas></div>'."\n";
|
||||
|
||||
$this->stringtoshow .= '<script id="'.$tag.'">'."\n";
|
||||
$i = $firstlot;
|
||||
if ($nblot < 0)
|
||||
{
|
||||
$this->stringtoshow .= '<!-- No series of data -->';
|
||||
}
|
||||
else
|
||||
{
|
||||
while ($i < $nblot)
|
||||
{
|
||||
//$this->stringtoshow .= '<!-- Series '.$i.' -->'."\n";
|
||||
//$this->stringtoshow .= $serie[$i]."\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$this->stringtoshow .= "\n";
|
||||
|
||||
// Special case for Graph of type 'pie', 'piesemicircle', or 'polar'
|
||||
if (isset($this->type[$firstlot]) && (in_array($this->type[$firstlot], array('pie', 'polar', 'piesemicircle'))))
|
||||
{
|
||||
$type = $this->type[$firstlot]; // pie or polar
|
||||
$this->stringtoshow .= 'var options = {'."\n";
|
||||
$legendMaxLines= 0; // Does not work
|
||||
if (empty($showlegend)) {
|
||||
$this->stringtoshow .= 'legend: { display: false }, ';
|
||||
} else {
|
||||
$this->stringtoshow .= 'legend: { position: \''.($showlegend == 2 ? 'right' : 'top').'\'';
|
||||
if (! empty($legendMaxLines)) {
|
||||
$this->stringtoshow .= ', maxLines: '.$legendMaxLines.'';
|
||||
}
|
||||
$this->stringtoshow .= ' }, '."\n";
|
||||
}
|
||||
|
||||
if ($this->type[$firstlot] == 'piesemicircle') {
|
||||
$this->stringtoshow .= 'circumference: Math.PI,'."\n";
|
||||
$this->stringtoshow .= 'rotation: -Math.PI,'."\n";
|
||||
}
|
||||
$this->stringtoshow .= 'elements: { arc: {'."\n";
|
||||
// Color of earch arc
|
||||
$this->stringtoshow .= 'backgroundColor: [';
|
||||
$i = 0; $foundnegativecolor = 0;
|
||||
foreach($legends as $val) // Loop on each serie
|
||||
{
|
||||
if ($i > 0) $this->stringtoshow .= ', '."\n";
|
||||
if (is_array($this->datacolor[$i])) $color = 'rgb('.$this->datacolor[$i][0].', '.$this->datacolor[$i][1].', '.$this->datacolor[$i][2].')'; // If datacolor is array(R, G, B)
|
||||
else {
|
||||
$tmp = str_replace('#', '', $this->datacolor[$i]);
|
||||
if (strpos($tmp, '-') !== false) {
|
||||
$foundnegativecolor++;
|
||||
$color = '#FFFFFF'; // If $val is '-123'
|
||||
}
|
||||
else $color = "#".$tmp; // If $val is '123' or '#123'
|
||||
}
|
||||
$this->stringtoshow .= "'".$color."'";
|
||||
$i++;
|
||||
}
|
||||
$this->stringtoshow .= '], '."\n";
|
||||
// Border color
|
||||
if ($foundnegativecolor) {
|
||||
$this->stringtoshow .= 'borderColor: [';
|
||||
$i = 0;
|
||||
foreach($legends as $val) // Loop on each serie
|
||||
{
|
||||
if ($i > 0) $this->stringtoshow .= ', '."\n";
|
||||
if (is_array($this->datacolor[$i])) $color = 'null'; // If datacolor is array(R, G, B)
|
||||
else {
|
||||
$tmp = str_replace('#', '', $this->datacolor[$i]);
|
||||
if (strpos($tmp, '-') !== false) $color = '#'.str_replace('-', '', $tmp); // If $val is '-123'
|
||||
else $color = 'null'; // If $val is '123' or '#123'
|
||||
}
|
||||
$this->stringtoshow .= ($color == 'null' ? "'rgba(0,0,0,0.2)'" : "'".$color."'");
|
||||
$i++;
|
||||
}
|
||||
$this->stringtoshow .= ']';
|
||||
}
|
||||
$this->stringtoshow .= '} } };'."\n";
|
||||
|
||||
$this->stringtoshow .= '
|
||||
var ctx = document.getElementById("canvas_'.$tag.'").getContext("2d");
|
||||
var chart = new Chart(ctx, {
|
||||
// The type of chart we want to create
|
||||
type: \''.(in_array($type, array('pie', 'piesemicircle')) ? 'doughnut' : 'polarArea').'\',
|
||||
// Configuration options go here
|
||||
options: options,
|
||||
data: {
|
||||
labels: [';
|
||||
|
||||
$i = 0;
|
||||
foreach($legends as $val) // Loop on each serie
|
||||
{
|
||||
if ($i > 0) $this->stringtoshow .= ', ';
|
||||
$this->stringtoshow .= "'".$val."'";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$this->stringtoshow .= '],
|
||||
datasets: [';
|
||||
$i = 0;
|
||||
$i = 0;
|
||||
while ($i < $nblot) // Loop on each serie
|
||||
{
|
||||
$color = 'rgb('.$this->datacolor[$i][0].', '.$this->datacolor[$i][1].', '.$this->datacolor[$i][2].')';
|
||||
//$color = (!empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor));
|
||||
|
||||
if ($i > 0) $this->stringtoshow .= ', '."\n";
|
||||
$this->stringtoshow .= '{'."\n";
|
||||
//$this->stringtoshow .= 'borderColor: \''.$color.'\', ';
|
||||
//$this->stringtoshow .= 'backgroundColor: \''.$color.'\', ';
|
||||
$this->stringtoshow .= ' data: ['.$serie[$i].']';
|
||||
$this->stringtoshow .= '}'."\n";
|
||||
$i++;
|
||||
}
|
||||
$this->stringtoshow .= ']'."\n";
|
||||
$this->stringtoshow .= '}'."\n";
|
||||
$this->stringtoshow .= '});'."\n";
|
||||
}
|
||||
// Other cases, graph of type 'bars', 'lines', 'linesnopoint'
|
||||
else
|
||||
{
|
||||
$type = 'bar';
|
||||
if (!isset($this->type[$firstlot]) || $this->type[$firstlot] == 'bars') $type = 'bar';
|
||||
if (isset($this->type[$firstlot]) && ($this->type[$firstlot] == 'lines' || $this->type[$firstlot] == 'linesnopoint')) $type = 'line';
|
||||
|
||||
$this->stringtoshow .= 'var options = { maintainAspectRatio: false, aspectRatio: 2.5, ';
|
||||
if (empty($showlegend)) {
|
||||
$this->stringtoshow .= 'legend: { display: false }, ';
|
||||
}
|
||||
$this->stringtoshow .= 'scales: { xAxes: [{ ';
|
||||
//$this->stringtoshow .= 'type: \'time\', '; // Need Moment.js
|
||||
$this->stringtoshow .= 'distribution: \'linear\'';
|
||||
if ($type == 'bar' && count($arrayofgroupslegend) > 0) {
|
||||
$this->stringtoshow .= ', stacked: true';
|
||||
}
|
||||
$this->stringtoshow .= ' }]';
|
||||
if ($type == 'bar' && count($arrayofgroupslegend) > 0) {
|
||||
$this->stringtoshow .= ', yAxes: [{ stacked: true }]';
|
||||
}
|
||||
$this->stringtoshow .= ' }';
|
||||
$this->stringtoshow .= '};';
|
||||
|
||||
$this->stringtoshow .= '
|
||||
var ctx = document.getElementById("canvas_'.$tag.'").getContext("2d");
|
||||
var chart = new Chart(ctx, {
|
||||
// The type of chart we want to create
|
||||
type: \''.$type.'\',
|
||||
// Configuration options go here
|
||||
options: options,
|
||||
data: {
|
||||
labels: [';
|
||||
|
||||
$i = 0;
|
||||
foreach($legends as $val) // Loop on each serie
|
||||
{
|
||||
if ($i > 0) $this->stringtoshow .= ', ';
|
||||
$this->stringtoshow .= "'".$val."'";
|
||||
$i++;
|
||||
}
|
||||
|
||||
//var_dump($arrayofgroupslegend);
|
||||
|
||||
$this->stringtoshow .= '],
|
||||
datasets: [';
|
||||
|
||||
global $theme_datacolor;
|
||||
//var_dump($arrayofgroupslegend);
|
||||
$i = 0; $iinstack = 0;
|
||||
$oldstacknum = -1;
|
||||
while ($i < $nblot) // Loop on each serie
|
||||
{
|
||||
$usecolorvariantforgroupby=0;
|
||||
// We used a 'group by' and we have too many colors so we generated color variants per
|
||||
if (is_array($arrayofgroupslegend[$i]) && count($arrayofgroupslegend[$i]) > 0) { // If we used a group by.
|
||||
$nbofcolorneeds = count($arrayofgroupslegend);
|
||||
$nbofcolorsavailable = count($theme_datacolor);
|
||||
if ($nbofcolorneeds > $nbofcolorsavailable) {
|
||||
$usecolorvariantforgroupby = 1;
|
||||
}
|
||||
|
||||
$textoflegend = $arrayofgroupslegend[$i]['legendwithgroup'];
|
||||
} else {
|
||||
$textoflegend = $this->Legend[$i];
|
||||
}
|
||||
if ($usecolorvariantforgroupby) {
|
||||
$newcolor = $this->datacolor[$arrayofgroupslegend[$i]['stacknum']];
|
||||
// If we change the stack
|
||||
if ($oldstacknum == -1 || $arrayofgroupslegend[$i]['stacknum'] != $oldstacknum) {
|
||||
$iinstack = 0;
|
||||
}
|
||||
|
||||
//var_dump($iinstack);
|
||||
if ($iinstack) {
|
||||
// Change color with offset of $$iinstack
|
||||
//var_dump($newcolor);
|
||||
if ($iinstack % 2) { // We increase agressiveness of reference color for color 2, 4, 6, ...
|
||||
$ratio = min(95, 10 + 10 * $iinstack); // step of 20
|
||||
$brightnessratio = min(90, 5 + 5 * $iinstack); // step of 10
|
||||
} else { // We decrease agressiveness of reference color for color 3, 5, 7, ..
|
||||
$ratio = max(-100, - 15 * $iinstack + 10); // step of -20
|
||||
$brightnessratio = min(90, 10 * $iinstack); // step of 20
|
||||
}
|
||||
//var_dump('Color '.($iinstack+1).' : '.$ratio.' '.$brightnessratio);
|
||||
|
||||
$newcolor = array_values(colorHexToRgb(colorAgressiveness(colorArrayToHex($newcolor), $ratio, $brightnessratio), false, true));
|
||||
}
|
||||
$oldstacknum = $arrayofgroupslegend[$i]['stacknum'];
|
||||
|
||||
$color = 'rgb('.$newcolor[0].', '.$newcolor[1].', '.$newcolor[2].', 0.9)';
|
||||
$bordercolor = 'rgb('.$newcolor[0].', '.$newcolor[1].', '.$newcolor[2].')';
|
||||
} else { // We do not use a 'group by'
|
||||
$color = 'rgb('.$this->datacolor[$i][0].', '.$this->datacolor[$i][1].', '.$this->datacolor[$i][2].', 0.9)';
|
||||
$bordercolor = $color;
|
||||
//$color = (!empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor));
|
||||
}
|
||||
|
||||
if ($i > 0) $this->stringtoshow .= ', ';
|
||||
$this->stringtoshow .= "\n";
|
||||
$this->stringtoshow .= '{';
|
||||
$this->stringtoshow .= 'dolibarrinfo: \'y_'.$i.'\', ';
|
||||
$this->stringtoshow .= 'label: \''.dol_escape_js(dol_string_nohtmltag($textoflegend)).'\', ';
|
||||
$this->stringtoshow .= 'pointStyle: \''.($this->type[$i] == 'linesnopoint' ? 'line' : 'circle').'\', ';
|
||||
$this->stringtoshow .= 'fill: '.($type == 'bar' ? 'true' : 'false').', ';
|
||||
if ($type == 'bar') { $this->stringtoshow .= 'borderWidth: \'1\', '; }
|
||||
$this->stringtoshow .= 'borderColor: \''.$bordercolor.'\', ';
|
||||
$this->stringtoshow .= 'backgroundColor: \''.$color.'\', ';
|
||||
if ($arrayofgroupslegend[$i]) $this->stringtoshow .= 'stack: \''.$arrayofgroupslegend[$i]['stacknum'].'\', ';
|
||||
$this->stringtoshow .= 'data: ['.$serie[$i].']';
|
||||
$this->stringtoshow .= '}'."\n";
|
||||
|
||||
$i++;
|
||||
$iinstack++;
|
||||
}
|
||||
$this->stringtoshow .= ']'."\n";
|
||||
$this->stringtoshow .= '}'."\n";
|
||||
$this->stringtoshow .= '});'."\n";
|
||||
}
|
||||
|
||||
$this->stringtoshow .= '</script>'."\n";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output HTML string to total value
|
||||
*
|
||||
|
||||
@ -202,7 +202,7 @@ class Form
|
||||
$ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">';
|
||||
if (empty($notabletag)) $ret .= '<table class="nobordernopadding centpercent" cellpadding="0" cellspacing="0">';
|
||||
if (empty($notabletag)) $ret .= '<tr><td>';
|
||||
if (preg_match('/^(string|email)/', $typeofdata))
|
||||
if (preg_match('/^(string|safehtmlstring|email)/', $typeofdata))
|
||||
{
|
||||
$tmp = explode(':', $typeofdata);
|
||||
$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.($tmp[1] ? ' size="'.$tmp[1].'"' : '').'>';
|
||||
@ -276,6 +276,7 @@ class Form
|
||||
if (preg_match('/^(email)/', $typeofdata)) $ret .= dol_print_email($value, 0, 0, 0, 0, 1);
|
||||
elseif (preg_match('/^(amount|numeric)/', $typeofdata)) $ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, $conf->currency) : '');
|
||||
elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) $ret .= dol_htmlentitiesbr($value);
|
||||
elseif (preg_match('/^safehtmlstring/', $typeofdata)) $ret .= dol_string_onlythesehtmltags($value);
|
||||
elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret .= dol_print_date($value, 'day');
|
||||
elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') $ret .= dol_print_date($value, 'dayhour');
|
||||
elseif (preg_match('/^select;/', $typeofdata))
|
||||
@ -2906,7 +2907,7 @@ class Form
|
||||
$objp->fprice = $price_result;
|
||||
if ($objp->quantity >= 1)
|
||||
{
|
||||
$objp->unitprice = $objp->fprice / $objp->quantity;
|
||||
$objp->unitprice = $objp->fprice / $objp->quantity; // Replace dynamically unitprice
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2973,7 +2974,7 @@ class Form
|
||||
if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) $opt .= ' disabled';
|
||||
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0)
|
||||
{
|
||||
$opt .= ' pbq="'.$objp->idprodfournprice.'" data-pbq="'.$objp->idprodfournprice.'" data-pbqqty="'.$objp->quantity.'" data-pbqpercent="'.$objp->remise_percent.'"';
|
||||
$opt .= ' pbq="'.$objp->idprodfournprice.'" data-pbq="'.$objp->idprodfournprice.'" data-pbqqty="'.$objp->quantity.'" data-pbqup="'.$objp->unitprice.'" data-pbqpercent="'.$objp->remise_percent.'"';
|
||||
}
|
||||
$opt .= ' data-html="'.dol_escape_htmltag($optlabel).'"';
|
||||
$opt .= '>';
|
||||
@ -2988,7 +2989,7 @@ class Form
|
||||
// "key" value of json key array is used by jQuery automatically as selected value
|
||||
// "label" value of json key array is used by jQuery automatically as text for combo box
|
||||
$out .= $opt;
|
||||
array_push($outarray, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, 'discount'=>$outdiscount, 'type'=>$outtype, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'disabled'=>(empty($objp->idprodfournprice) ?true:false)));
|
||||
array_push($outarray, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, 'up'=>$objp->unitprice, 'discount'=>$outdiscount, 'type'=>$outtype, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'disabled'=>(empty($objp->idprodfournprice) ?true:false)));
|
||||
// Exemple of var_dump $outarray
|
||||
// array(1) {[0]=>array(6) {[key"]=>string(1) "2" ["value"]=>string(3) "ppp"
|
||||
// ["label"]=>string(76) "ppp (<strong>f</strong>ff2) - ppp - 20,00 Euros/1unité (20,00 Euros/unité)"
|
||||
@ -3507,7 +3508,7 @@ class Form
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return list of payment methods
|
||||
* Constant MAIN_DEFAULT_PAYMENT_TYPE_ID can used to set default value but scope is all application, probably not what you want.
|
||||
* Constant MAIN_DEFAULT_PAYMENT_TYPE_ID can used to set default value but scope is all application, probably not what you want.
|
||||
*
|
||||
* @param string $selected Id du mode de paiement pre-selectionne
|
||||
* @param string $htmlname Nom de la zone select
|
||||
@ -5268,8 +5269,9 @@ class Form
|
||||
$disabled = false; $title = '';
|
||||
if (is_object($societe_vendeuse) && $societe_vendeuse->id == $mysoc->id && $societe_vendeuse->tva_assuj == "0")
|
||||
{
|
||||
// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses
|
||||
if (empty($conf->global->OVERRIDE_VAT_FOR_EXPENSE_REPORT))
|
||||
// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead
|
||||
// of using supplier invoices (this is a very bad idea !)
|
||||
if (empty($conf->global->EXPENSEREPORT_OVERRIDE_VAT))
|
||||
{
|
||||
$title = ' title="'.$langs->trans('VATIsNotUsed').'"';
|
||||
$disabled = true;
|
||||
|
||||
58
htdocs/core/class/html.formcategory.class.php
Normal file
58
htdocs/core/class/html.formcategory.class.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/class/html.formcategory.class.php
|
||||
* \ingroup core
|
||||
* \brief File of class to build HTML component for category filtering
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
|
||||
class FormCategory extends Form
|
||||
{
|
||||
/**
|
||||
* Return a HTML filter box for a list filter view
|
||||
*
|
||||
* @param string $type The categorie type (e.g Categorie::TYPE_WAREHOUSE)
|
||||
* @param Array $preSelected A list with the elements that should pre-selected
|
||||
* @return string A HTML filter box (Note: selected results can get with GETPOST("search_category_".$type."_list"))
|
||||
*/
|
||||
public function getFilterBox($type, $preSelected)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
if (empty($preSelected) || !is_array($preSelected))
|
||||
{
|
||||
$preSelected = array();
|
||||
}
|
||||
|
||||
$htmlName = "search_category_".$type."_list";
|
||||
|
||||
$categoryArray = $this->select_all_categories($type, "", "", 64, 0, 1);
|
||||
$categoryArray[-2] = "- ".$langs->trans('NotCategorized')." -";
|
||||
|
||||
$filter = '';
|
||||
$filter .= '<div class="divsearchfield">';
|
||||
$filter .= $langs->trans('Categories').": ";
|
||||
$filter .= Form::multiselectarray($htmlName, $categoryArray, $preSelected, 0, 0, "minwidth300");
|
||||
$filter .= "</div>";
|
||||
|
||||
return $filter;
|
||||
}
|
||||
}
|
||||
@ -249,8 +249,7 @@ class FormCompany extends Form
|
||||
}
|
||||
}
|
||||
|
||||
if ((!empty($selected) && $selected == $obj->rowid)
|
||||
|| (empty($selected) && !empty($conf->global->MAIN_FORCE_DEFAULT_STATE_ID) && $conf->global->MAIN_FORCE_DEFAULT_STATE_ID == $obj->rowid))
|
||||
if (!empty($selected) && $selected == $obj->rowid)
|
||||
{
|
||||
$out .= '<option value="'.$obj->rowid.'" selected>';
|
||||
}
|
||||
@ -960,7 +959,7 @@ class FormCompany extends Form
|
||||
$out .= '<option value="2,3"'.($selected == '2,3' ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>';
|
||||
}
|
||||
$out .= '<option value="4"'.($selected == '4' ? ' selected' : '').'>'.$langs->trans('Supplier').'</option>';
|
||||
$out .= '<option value="0"'.($selected == '0' ? ' selected' : '').'>'.$langs->trans('Others').'</option>';
|
||||
$out .= '<option value="0"'.($selected == '0' ? ' selected' : '').'>'.$langs->trans('Other').'</option>';
|
||||
} elseif ($typeinput == 'admin') {
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
|
||||
$out .= '<option value="3"'.($selected == 3 ? ' selected' : '').'>'.$langs->trans('ProspectCustomer').'</option>';
|
||||
|
||||
@ -1027,6 +1027,7 @@ class FormMail extends Form
|
||||
$out .= ' $(document).on("keypress", \'#mailform\', function (e) { /* Note this is called at every key pressed ! */
|
||||
var code = e.keyCode || e.which;
|
||||
if (code == 13) {
|
||||
console.log("Enter was intercepted and blocked");
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1338,4 +1338,122 @@ class FormOther
|
||||
$resultautomanual .= '</select>'."\n";
|
||||
return $resultautomanual;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return HTML select list to select a group by field
|
||||
*
|
||||
* @param mixed $object Object analyzed
|
||||
* @param array $search_groupby Array of preselected fields
|
||||
* @param array $arrayofgroupby Array of groupby to fill
|
||||
* @return string HTML string component
|
||||
*/
|
||||
public function selectGroupByField($object, $search_groupby, &$arrayofgroupby)
|
||||
{
|
||||
global $langs, $extrafields, $form;
|
||||
|
||||
$YYYY=substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
|
||||
$MM=substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
|
||||
$DD=substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
|
||||
$HH=substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
|
||||
$MI=substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
|
||||
$SS=substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
|
||||
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (!$val['measure']) {
|
||||
if (in_array($key, array(
|
||||
'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
|
||||
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) continue;
|
||||
if (isset($val['enabled']) && !dol_eval($val['enabled'], 1)) continue;
|
||||
if (isset($val['visible']) && !dol_eval($val['visible'], 1)) continue;
|
||||
if (preg_match('/^fk_/', $key) && !preg_match('/^fk_statu/', $key)) continue;
|
||||
if (preg_match('/^pass/', $key)) continue;
|
||||
if (in_array($val['type'], array('html', 'text'))) continue;
|
||||
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
|
||||
$arrayofgroupby['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.')', 'position' => $val['position'].'-y');
|
||||
$arrayofgroupby['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => $val['position'].'-m');
|
||||
$arrayofgroupby['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => $val['position'].'-d');
|
||||
} else {
|
||||
$arrayofgroupby['t.'.$key] = array('label' => $langs->trans($val['label']), 'position' => (int) $val['position']);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add extrafields to Group by
|
||||
if ($object->isextrafieldmanaged) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') continue;
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) continue;
|
||||
$arrayofgroupby['te.'.$key] = array('label' => $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]), 'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$arrayofgroupby = dol_sort_array($arrayofgroupby, 'position', 'asc', 0, 0, 1);
|
||||
$arrayofgroupbylabel = array();
|
||||
foreach ($arrayofgroupby as $key => $val) {
|
||||
$arrayofgroupbylabel[$key] = $val['label'];
|
||||
}
|
||||
$result = $form->selectarray('search_groupby', $arrayofgroupbylabel, $search_groupby, 1, 0, 0, '', 0, 0, 0, '', 'minwidth250', 1);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return HTML select list to select a group by field
|
||||
*
|
||||
* @param mixed $object Object analyzed
|
||||
* @param array $search_xaxis Array of preselected fields
|
||||
* @param array $arrayofxaxis Array of groupby to fill
|
||||
* @return string HTML string component
|
||||
*/
|
||||
public function selectXAxisField($object, $search_xaxis, &$arrayofxaxis)
|
||||
{
|
||||
global $langs, $extrafields, $form;
|
||||
|
||||
$YYYY=substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
|
||||
$MM=substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
|
||||
$DD=substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
|
||||
$HH=substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
|
||||
$MI=substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
|
||||
$SS=substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
|
||||
|
||||
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (!$val['measure']) {
|
||||
if (in_array($key, array(
|
||||
'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
|
||||
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) continue;
|
||||
if (isset($val['enabled']) && !dol_eval($val['enabled'], 1)) continue;
|
||||
if (isset($val['visible']) && !dol_eval($val['visible'], 1)) continue;
|
||||
if (preg_match('/^fk_/', $key) && !preg_match('/^fk_statu/', $key)) continue;
|
||||
if (preg_match('/^pass/', $key)) continue;
|
||||
if (in_array($val['type'], array('html', 'text'))) continue;
|
||||
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
|
||||
$arrayofxaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.')', 'position' => $val['position'].'-y');
|
||||
$arrayofxaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => $val['position'].'-m');
|
||||
$arrayofxaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => $val['position'].'-d');
|
||||
} else {
|
||||
$arrayofxaxis['t.'.$key] = array('label' => $langs->trans($val['label']), 'position' => (int) $val['position']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add extrafields to X-Axis
|
||||
if ($object->isextrafieldmanaged) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') continue;
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) continue;
|
||||
$arrayofxaxis['te.'.$key] = array('label' => $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]), 'position' => 1000 + (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$arrayofxaxis = dol_sort_array($arrayofxaxis, 'position', 'asc', 0, 0, 1);
|
||||
|
||||
$arrayofxaxislabel = array();
|
||||
foreach ($arrayofxaxis as $key => $val) {
|
||||
$arrayofxaxislabel[$key] = $val['label'];
|
||||
}
|
||||
$result = $form->selectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, 1, 0, 0, '', 0, 0, 0, '', 'minwidth250', 1);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -269,13 +269,14 @@ abstract class Stats
|
||||
*
|
||||
* @param int $year Year
|
||||
* @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save)
|
||||
* @param int $limit Limit
|
||||
* @return array Array of values
|
||||
*/
|
||||
public function getAllByProductEntry($year, $cachedelay = 0)
|
||||
public function getAllByProductEntry($year, $cachedelay = 0, $limit = 10)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
$datay=array();
|
||||
$data=array();
|
||||
|
||||
// Search into cache
|
||||
if (! empty($cachedelay))
|
||||
@ -313,7 +314,7 @@ abstract class Stats
|
||||
}
|
||||
else
|
||||
{
|
||||
$data=$this->getAllByProduct($year);
|
||||
$data = $this->getAllByProduct($year, $limit);
|
||||
// $data[$i][]=$datay[$year][$i][1]; // set yval for x=i
|
||||
}
|
||||
|
||||
@ -604,7 +605,6 @@ abstract class Stats
|
||||
global $langs;
|
||||
|
||||
$result=array();
|
||||
$res=array();
|
||||
|
||||
dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
@ -282,7 +282,7 @@ class Translate
|
||||
* and split the rest until a line feed.
|
||||
* This is more efficient than fgets + explode + trim by a factor of ~2.
|
||||
*/
|
||||
while ($line = fscanf($fp, "%[^= ]%*[ =]%[^\n]"))
|
||||
while ($line = fscanf($fp, "%[^= ]%*[ =]%[^\n\r]"))
|
||||
{
|
||||
if (isset($line[1]))
|
||||
{
|
||||
|
||||
@ -28,10 +28,6 @@
|
||||
if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE'))
|
||||
{
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/class/dolgraph.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php";
|
||||
|
||||
// Get parameters
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||
@ -45,7 +41,14 @@ if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE'))
|
||||
|
||||
$search_filters = GETPOST('search_filters', 'array');
|
||||
$search_measures = GETPOST('search_measures', 'array');
|
||||
$search_xaxis = GETPOST('search_xaxis', 'array');
|
||||
|
||||
//$search_xaxis = GETPOST('search_xaxis', 'array');
|
||||
if (GETPOST('search_xaxis', 'alpha') && GETPOST('search_xaxis', 'alpha') != '-1') $search_xaxis = array(GETPOST('search_xaxis', 'alpha'));
|
||||
else $search_xaxis = array();
|
||||
//$search_groupby = GETPOST('search_groupby', 'array');
|
||||
if (GETPOST('search_groupby', 'alpha') && GETPOST('search_groupby', 'alpha') != '-1') $search_groupby = array(GETPOST('search_groupby', 'alpha'));
|
||||
else $search_groupby = array();
|
||||
|
||||
$search_yaxis = GETPOST('search_yaxis', 'array');
|
||||
$search_graph = GETPOST('search_graph', 'none');
|
||||
|
||||
@ -62,8 +65,14 @@ if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE'))
|
||||
$diroutputmassaction = $conf->user->dir_temp.'/'.$user->id.'/customreport';
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/class/dolgraph.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php";
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->loadLangs(array("companies", "other", "exports"));
|
||||
$langs->loadLangs(array("companies", "other", "exports", "sendings"));
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
@ -76,16 +85,18 @@ $object = null;
|
||||
$ObjectClassName = '';
|
||||
// Objects available by default
|
||||
$arrayoftype = array(
|
||||
'thirdparty' => array('label' => 'ThirdParties', 'ObjectClassName' => 'Societe', 'enabled' => $conf->societe->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"),
|
||||
'contact' => array('label' => 'Contacts', 'ObjectClassName' => 'Contact', 'enabled' => $conf->societe->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/contact/class/contact.class.php"),
|
||||
'contract' => array('label' => 'Contracts', 'ObjectClassName' => 'Contrat', 'enabled' => $conf->contrat->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php", 'langs'=>'contract'),
|
||||
'invoice' => array('label' => 'Invoices', 'ObjectClassName' => 'Facture', 'enabled' => $conf->facture->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"),
|
||||
'invoice_template'=>array('label' => 'PredefinedInvoices', 'ObjectClassName' => 'FactureRec', 'enabled' => $conf->facture->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/compta/class/facturerec.class.php", 'langs'=>'bills'),
|
||||
'thirdparty' => array('label' => 'ThirdParties', 'ObjectClassName' => 'Societe', 'enabled' => $conf->societe->enabled, 'ClassPath' => "/societe/class/societe.class.php"),
|
||||
'contact' => array('label' => 'Contacts', 'ObjectClassName' => 'Contact', 'enabled' => $conf->societe->enabled, 'ClassPath' => "/contact/class/contact.class.php"),
|
||||
'proposal' => array('label' => 'Proposals', 'ObjectClassName' => 'Propal', 'enabled' => $conf->propal->enabled, 'ClassPath' => "/comm/propal/class/propal.class.php"),
|
||||
'order' => array('label' => 'Orders', 'ObjectClassName' => 'Commande', 'enabled' => $conf->commande->enabled, 'ClassPath' => "/commande/class/commande.class.php"),
|
||||
'invoice' => array('label' => 'Invoices', 'ObjectClassName' => 'Facture', 'enabled' => $conf->facture->enabled, 'ClassPath' => "/compta/facture/class/facture.class.php"),
|
||||
'invoice_template'=>array('label' => 'PredefinedInvoices', 'ObjectClassName' => 'FactureRec', 'enabled' => $conf->facture->enabled, 'ClassPath' => "/compta/class/facturerec.class.php", 'langs'=>'bills'),
|
||||
'contract' => array('label' => 'Contracts', 'ObjectClassName' => 'Contrat', 'enabled' => $conf->contrat->enabled, 'ClassPath' => "/contrat/class/contrat.class.php", 'langs'=>'contract'),
|
||||
'bom' => array('label' => 'BOM', 'ObjectClassName' => 'Bom', 'enabled' => $conf->bom->enabled),
|
||||
'mo' => array('label' => 'MO', 'ObjectClassName' => 'Mo', 'enabled' => $conf->mrp->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/mrp/class/mo.class.php"),
|
||||
'mo' => array('label' => 'MO', 'ObjectClassName' => 'Mo', 'enabled' => $conf->mrp->enabled, 'ClassPath' => "/mrp/class/mo.class.php"),
|
||||
'ticket' => array('label' => 'Ticket', 'ObjectClassName' => 'Ticket', 'enabled' => $conf->ticket->enabled),
|
||||
'member' => array('label' => 'Adherent', 'ObjectClassName' => 'Adherent', 'enabled' => $conf->adherent->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php", 'langs'=>'members'),
|
||||
'cotisation' => array('label' => 'Subscriptions', 'ObjectClassName' => 'Subscription', 'enabled' => $conf->adherent->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/adherents/class/subscription.class.php", 'langs'=>'members'),
|
||||
'member' => array('label' => 'Adherent', 'ObjectClassName' => 'Adherent', 'enabled' => $conf->adherent->enabled, 'ClassPath' => "/adherents/class/adherent.class.php", 'langs'=>'members'),
|
||||
'cotisation' => array('label' => 'Subscriptions', 'ObjectClassName' => 'Subscription', 'enabled' => $conf->adherent->enabled, 'ClassPath' => "/adherents/class/subscription.class.php", 'langs'=>'members'),
|
||||
);
|
||||
|
||||
// Complete $arrayoftype by external modules
|
||||
@ -107,17 +118,14 @@ elseif (is_array($hookmanager->resArray)) {
|
||||
$arrayoftype[$key] = $val;
|
||||
}
|
||||
}
|
||||
if (!empty($hookmanager->resArray['modenotusedforlist'])) { // Show objecttype selection even if objecttype is set
|
||||
$modenotusedforlist = $hookmanager->resArray['modenotusedforlist'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($objecttype) {
|
||||
try {
|
||||
if ($arrayoftype[$objecttype]['ClassPath']) {
|
||||
include_once $arrayoftype[$objecttype]['ClassPath'];
|
||||
if (! empty($arrayoftype[$objecttype]['ClassPath'])) {
|
||||
dol_include_once($arrayoftype[$objecttype]['ClassPath']);
|
||||
} else {
|
||||
include_once DOL_DOCUMENT_ROOT."/".$objecttype."/class/".$objecttype.".class.php";
|
||||
dol_include_once("/".$objecttype."/class/".$objecttype.".class.php");
|
||||
}
|
||||
$ObjectClassName = $arrayoftype[$objecttype]['ObjectClassName'];
|
||||
$object = new $ObjectClassName($db);
|
||||
@ -134,6 +142,7 @@ if ($user->socid > 0) // Protection if external user
|
||||
//$socid = $user->socid;
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, $object->element, 0, '');
|
||||
|
||||
// Fetch optionals attributes and labels
|
||||
@ -144,6 +153,23 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
||||
|
||||
$search_component_params = array('');
|
||||
|
||||
$MAXUNIQUEVALFORGROUP = 20;
|
||||
$MAXMEASURESINBARGRAPH = 20;
|
||||
|
||||
$YYYY=substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
|
||||
$MM=substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
|
||||
$DD=substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
|
||||
$HH=substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
|
||||
$MI=substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
|
||||
$SS=substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
|
||||
|
||||
$arrayofmesures = array('t.count'=>'Count');
|
||||
$arrayofxaxis = array();
|
||||
$arrayofgroupby = array();
|
||||
$arrayofyaxis = array();
|
||||
$arrayofvaluesforgroupby = array();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -158,6 +184,7 @@ $search_component_params = array('');
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
if (!defined('USE_CUSTOME_REPORT_AS_INCLUDE')) {
|
||||
llxHeader('', $langs->transnoentitiesnoconv('CustomReports'), '');
|
||||
@ -173,14 +200,89 @@ if ($action == 'viewgraph') {
|
||||
setEventMessages($langs->trans("OnlyOneFieldForXAxisIsPossible"), null, 'warnings');
|
||||
$search_xaxis = array(0 => $search_xaxis[0]);
|
||||
}
|
||||
if (count($search_groupby) >= 2) {
|
||||
setEventMessages($langs->trans("ErrorOnlyOneFieldForGroupByIsPossible"), null, 'warnings');
|
||||
$search_groupby = array(0 => $search_groupby[0]);
|
||||
}
|
||||
if (!count($search_xaxis)) {
|
||||
setEventMessages($langs->trans("AtLeastOneXAxisIsRequired"), null, 'warnings');
|
||||
} elseif ($mode == 'graph' && $search_graph == 'bars' && count($search_measures) > 3) {
|
||||
setEventMessages($langs->trans("GraphInBarsAreLimitedTo3Measures"), null, 'warnings');
|
||||
} elseif ($mode == 'graph' && $search_graph == 'bars' && count($search_measures) > $MAXMEASURESINBARGRAPH) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("GraphInBarsAreLimitedToNMeasures", $MAXMEASURESINBARGRAPH), null, 'warnings');
|
||||
$search_graph = 'lines';
|
||||
}
|
||||
}
|
||||
|
||||
// Get all possible values of fields when a 'group by' is set and save this into $arrayofvaluesforgroupby
|
||||
if (is_array($search_groupby) && count($search_groupby)) {
|
||||
foreach($search_groupby as $gkey => $gval) {
|
||||
$gvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $gval);
|
||||
|
||||
if (preg_match('/\-year$/', $search_groupby[$gkey])) {
|
||||
$tmpval = preg_replace('/\-year$/', '', $search_groupby[$gkey]);
|
||||
$fieldtocount .= 'DATE_FORMAT('.$tmpval.", '%Y')";
|
||||
} elseif (preg_match('/\-month$/', $search_groupby[$gkey])) {
|
||||
$tmpval = preg_replace('/\-month$/', '', $search_groupby[$gkey]);
|
||||
$fieldtocount .= 'DATE_FORMAT('.$tmpval.", '%Y-%m')";
|
||||
} elseif (preg_match('/\-day$/', $search_groupby[$gkey])) {
|
||||
$tmpval = preg_replace('/\-day$/', '', $search_groupby[$gkey]);
|
||||
$fieldtocount .= 'DATE_FORMAT('.$tmpval.", '%Y-%m-%d')";
|
||||
} else {
|
||||
$fieldtocount = $search_groupby[$gkey];
|
||||
}
|
||||
|
||||
$sql = 'SELECT DISTINCT '.$fieldtocount.' as val';
|
||||
if (strpos($fieldtocount, 'te.') === 0) {
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$object->table_element.'_extrafields as te';
|
||||
} else {
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t';
|
||||
}
|
||||
// TODO Add the where here
|
||||
|
||||
$sql.= ' LIMIT '.($MAXUNIQUEVALFORGROUP + 1);
|
||||
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
if (is_null($obj->val)) {
|
||||
$keytouse = '__NULL__';
|
||||
$valuetranslated = $langs->transnoentitiesnoconv("NotDefined");
|
||||
}
|
||||
elseif ($obj->val === '') {
|
||||
$keytouse = '';
|
||||
$valuetranslated = $langs->transnoentitiesnoconv("Empty");
|
||||
}
|
||||
else {
|
||||
$keytouse = (string) $obj->val;
|
||||
$valuetranslated = $obj->val;
|
||||
}
|
||||
if (!empty($object->fields[$gvalwithoutprefix]['arrayofkeyval'])) {
|
||||
$valuetranslated = $object->fields[$gvalwithoutprefix]['arrayofkeyval'][$obj->val];
|
||||
}
|
||||
|
||||
$arrayofvaluesforgroupby['g_'.$gkey][$keytouse] = $valuetranslated;
|
||||
}
|
||||
asort($arrayofvaluesforgroupby['g_'.$gkey]);
|
||||
|
||||
if (count($arrayofvaluesforgroupby['g_'.$gkey]) > $MAXUNIQUEVALFORGROUP) {
|
||||
$langs->load("errors");
|
||||
//var_dump($gkey.' '.$gval.' '.$gvalwithoutprefix);
|
||||
$gvalwithoutprefix = preg_replace('/\-(year|month|day)/', '', $gvalwithoutprefix);
|
||||
$labeloffield = $langs->transnoentitiesnoconv($object->fields[$gvalwithoutprefix]['label']);
|
||||
setEventMessages($langs->trans("ErrorTooManyDifferentValueForSelectedGroupBy", $MAXUNIQUEVALFORGROUP, $labeloffield), null, 'warnings');
|
||||
$search_groupby = array();
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
}
|
||||
//var_dump($arrayofvaluesforgroupby);exit;
|
||||
|
||||
|
||||
$tmparray = dol_getdate(dol_now());
|
||||
$endyear = $tmparray['year'];
|
||||
$endmonth = $tmparray['mon'];
|
||||
@ -189,10 +291,6 @@ $startyear = $endyear - 2;
|
||||
|
||||
$param = '';
|
||||
|
||||
$arrayofmesures = array('t.count'=>'Count');
|
||||
$arrayofxaxis = array();
|
||||
$arrayofyaxis = array();
|
||||
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="viewgraph">';
|
||||
@ -212,7 +310,7 @@ foreach ($arrayoftype as $key => $val) {
|
||||
$langs->load($val['langs']);
|
||||
}
|
||||
}
|
||||
print $form->selectarray('objecttype', $newarrayoftype, $objecttype, 0, 0, 0, '', 1, 0, 0, '', '', 1);
|
||||
print $form->selectarray('objecttype', $newarrayoftype, $objecttype, 0, 0, 0, '', 1, 0, 0, '', 'minwidth200', 1);
|
||||
if (empty($conf->use_javascript_ajax)) print '<input type="submit" class="button" name="changeobjecttype" value="'.$langs->trans("Refresh").'">';
|
||||
else {
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
@ -231,20 +329,20 @@ print '<div class="divadvancedsearchfield quatrevingtpercent">';
|
||||
print $form->searchComponent(array($object->element => $object->fields), $search_component_params);
|
||||
print '</div>';
|
||||
|
||||
// Measures
|
||||
// Add measures into array
|
||||
print '<div class="divadvancedsearchfield clearboth">';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if ($val['isameasure']) {
|
||||
if (!empty($val['isameasure']) && (! isset($val['enabled']) || dol_eval($val['enabled'], 1))) {
|
||||
$arrayofmesures['t.'.$key.'-sum'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>';
|
||||
$arrayofmesures['t.'.$key.'-average'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Average").')</span>';
|
||||
$arrayofmesures['t.'.$key.'-min'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Minimum").')</span>';
|
||||
$arrayofmesures['t.'.$key.'-max'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Maximum").')</span>';
|
||||
}
|
||||
}
|
||||
// Add measure from extrafields
|
||||
// Add extrafields to Measures
|
||||
if ($object->isextrafieldmanaged) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (! isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1))) {
|
||||
$arrayofmesures['te.'.$key.'-sum'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>';
|
||||
$arrayofmesures['te.'.$key.'-average'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Average").')</span>';
|
||||
$arrayofmesures['te.'.$key.'-min'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Minimum").')</span>';
|
||||
@ -252,59 +350,37 @@ if ($object->isextrafieldmanaged) {
|
||||
}
|
||||
}
|
||||
}
|
||||
print '<div class="inline-block opacitymedium"><span class="fas fa-chart-line paddingright" title="'.$langs->trans("Measures").'"></span>'.$langs->trans("Measures").'</div> ';
|
||||
print '<div class="inline-block"><span class="fas fa-chart-line paddingright" title="'.$langs->trans("Measures").'"></span>'.$langs->trans("Measures").'</div> ';
|
||||
print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth500', 1);
|
||||
print '</div>';
|
||||
|
||||
// XAxis
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (!$val['measure']) {
|
||||
if (in_array($key, array(
|
||||
'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
|
||||
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) continue;
|
||||
if (isset($val['enabled']) && !dol_eval($val['enabled'], 1)) continue;
|
||||
if (isset($val['visible']) && !dol_eval($val['visible'], 1)) continue;
|
||||
if (preg_match('/^fk_/', $key) && !preg_match('/^fk_statu/', $key)) continue;
|
||||
if (preg_match('/^pass/', $key)) continue;
|
||||
if (in_array($val['type'], array('html', 'text'))) continue;
|
||||
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
|
||||
$arrayofxaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Year").')', 'position' => $val['position'].'-y');
|
||||
$arrayofxaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Month").')', 'position' => $val['position'].'-m');
|
||||
$arrayofxaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Day").')', 'position' => $val['position'].'-d');
|
||||
} else {
|
||||
$arrayofxaxis['t.'.$key] = array('label' => $val['label'], 'position' => (int) $val['position']);
|
||||
}
|
||||
}
|
||||
// Add measure from extrafields
|
||||
if ($object->isextrafieldmanaged) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$arrayofxaxis['te.'.$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$arrayofxaxis = dol_sort_array($arrayofxaxis, 'position', 'asc', 1);
|
||||
$arrayofxaxislabel = array();
|
||||
foreach ($arrayofxaxis as $key => $val) {
|
||||
$arrayofxaxislabel[$key] = $val['label'];
|
||||
}
|
||||
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright" title="'.$langs->trans("XAxis").'"></span>'.$langs->trans("XAxis").'</div> ';
|
||||
print $form->multiselectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, 0, 0, 'minwidth500', 1);
|
||||
// Group by
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright" title="'.$langs->trans("GroupBy").'"></span>'.$langs->trans("GroupBy").'</div> ';
|
||||
print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby);
|
||||
print '</div>';
|
||||
|
||||
// YAxis
|
||||
|
||||
// XAxis
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
print '<div class="inline-block"><span class="fas fa-ruler-horizontal paddingright" title="'.$langs->trans("XAxis").'"></span>'.$langs->trans("XAxis").'</div> ';
|
||||
print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis);
|
||||
print '</div>';
|
||||
|
||||
|
||||
if ($mode == 'grid') {
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
// YAxis
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (!$val['measure']) {
|
||||
if (empty($val['measure']) && (! isset($val['enabled']) || dol_eval($val['enabled'], 1))) {
|
||||
if (in_array($key, array('id', 'rowid', 'entity', 'last_main_doc', 'extraparams'))) continue;
|
||||
if (preg_match('/^fk_/', $key)) continue;
|
||||
if (in_array($val['type'], array('html', 'text'))) continue;
|
||||
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
|
||||
$arrayofyaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Year").')', 'position' => $val['position']);
|
||||
$arrayofyaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Month").')', 'position' => $val['position']);
|
||||
$arrayofyaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Day").')', 'position' => $val['position']);
|
||||
$arrayofyaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.')', 'position' => $val['position']);
|
||||
$arrayofyaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => $val['position']);
|
||||
$arrayofyaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => $val['position']);
|
||||
} else {
|
||||
$arrayofyaxis['t.'.$key] = array('label' => $val['label'], 'position' => (int) $val['position']);
|
||||
}
|
||||
@ -312,8 +388,8 @@ if ($mode == 'grid') {
|
||||
// Add measure from extrafields
|
||||
if ($object->isextrafieldmanaged) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) {
|
||||
$arrayofyaxis['te.'.$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (! isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1))) {
|
||||
$arrayofyaxis['te.'.$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -341,7 +417,6 @@ print '</div>';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
|
||||
// Generate the SQL request
|
||||
$sql = '';
|
||||
if (!empty($search_measures) && !empty($search_xaxis))
|
||||
@ -362,6 +437,19 @@ if (!empty($search_measures) && !empty($search_xaxis))
|
||||
}
|
||||
else $sql .= $val.' as x_'.$key.', ';
|
||||
}
|
||||
foreach ($search_groupby as $key => $val) {
|
||||
if (preg_match('/\-year$/', $val)) {
|
||||
$tmpval = preg_replace('/\-year$/', '', $val);
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y') as g_".$key.', ';
|
||||
} elseif (preg_match('/\-month$/', $val)) {
|
||||
$tmpval = preg_replace('/\-month$/', '', $val);
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m') as g_".$key.', ';
|
||||
} elseif (preg_match('/\-day$/', $val)) {
|
||||
$tmpval = preg_replace('/\-day$/', '', $val);
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m-%d') as g_".$key.', ';
|
||||
}
|
||||
else $sql .= $val.' as g_'.$key.', ';
|
||||
}
|
||||
foreach ($search_measures as $key => $val) {
|
||||
if ($val == 't.count') $sql .= 'COUNT(t.'.$fieldid.') as y_'.$key.', ';
|
||||
elseif (preg_match('/\-sum$/', $val)) {
|
||||
@ -401,7 +489,7 @@ if (!empty($search_measures) && !empty($search_xaxis))
|
||||
$sql .= ' AND entity IN ('.getEntity($object->element).')';
|
||||
}
|
||||
foreach ($search_filters as $key => $val) {
|
||||
// TODO
|
||||
// TODO Add the where here
|
||||
}
|
||||
$sql .= ' GROUP BY ';
|
||||
foreach ($search_xaxis as $key => $val) {
|
||||
@ -417,6 +505,19 @@ if (!empty($search_measures) && !empty($search_xaxis))
|
||||
}
|
||||
else $sql .= $val.', ';
|
||||
}
|
||||
foreach ($search_groupby as $key => $val) {
|
||||
if (preg_match('/\-year$/', $val)) {
|
||||
$tmpval = preg_replace('/\-year$/', '', $val);
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y'), ";
|
||||
} elseif (preg_match('/\-month$/', $val)) {
|
||||
$tmpval = preg_replace('/\-month$/', '', $val);
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m'), ";
|
||||
} elseif (preg_match('/\-day$/', $val)) {
|
||||
$tmpval = preg_replace('/\-day$/', '', $val);
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m-%d'), ";
|
||||
}
|
||||
else $sql .= $val.', ';
|
||||
}
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
$sql .= ' ORDER BY ';
|
||||
foreach ($search_xaxis as $key => $val) {
|
||||
@ -432,15 +533,32 @@ if (!empty($search_measures) && !empty($search_xaxis))
|
||||
}
|
||||
else $sql .= $val.', ';
|
||||
}
|
||||
foreach ($search_groupby as $key => $val) {
|
||||
if (preg_match('/\-year$/', $val)) {
|
||||
$tmpval = preg_replace('/\-year$/', '', $val);
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y'), ";
|
||||
} elseif (preg_match('/\-month$/', $val)) {
|
||||
$tmpval = preg_replace('/\-month$/', '', $val);
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m'), ";
|
||||
} elseif (preg_match('/\-day$/', $val)) {
|
||||
$tmpval = preg_replace('/\-day$/', '', $val);
|
||||
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m-%d'), ";
|
||||
}
|
||||
else $sql .= $val.', ';
|
||||
}
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
}
|
||||
|
||||
//print $sql;
|
||||
|
||||
$legend = array();
|
||||
foreach ($search_measures as $key => $val) {
|
||||
$legend[] = $langs->trans($arrayofmesures[$val]);
|
||||
}
|
||||
|
||||
$useagroupby = (is_array($search_groupby) && count($search_groupby));
|
||||
//var_dump($useagroupby);
|
||||
//var_dump($arrayofvaluesforgroupby);
|
||||
|
||||
// Execute the SQL request
|
||||
$totalnbofrecord = 0;
|
||||
$data = array();
|
||||
@ -450,26 +568,111 @@ if ($sql) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$ifetch = 0; $xi = 0; $oldlabeltouse = '';
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
// $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // or when there is n series to show for each x
|
||||
foreach ($search_xaxis as $xkey => $xval) {
|
||||
$fieldforxkey = 'x_'.$xkey;
|
||||
$xlabel = $obj->$fieldforxkey;
|
||||
$xvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $xval);
|
||||
if (!empty($object->fields[$xvalwithoutprefix]['arrayofkeyval'])) {
|
||||
$xlabel = $object->fields[$xvalwithoutprefix]['arrayofkeyval'][$obj->$fieldforxkey];
|
||||
}
|
||||
$xarray = array(0 => (($xlabel || $xlabel == '0') ? dol_trunc($xlabel, 20, 'middle') : $langs->trans("NotDefined")));
|
||||
foreach ($search_measures as $key => $val) {
|
||||
$fieldfory = 'y_'.$key;
|
||||
$xarray[] = $obj->$fieldfory;
|
||||
}
|
||||
$data[] = $xarray;
|
||||
}
|
||||
$ifetch++;
|
||||
if ($useagroupby) {
|
||||
$xval = $search_xaxis[0];
|
||||
$fieldforxkey = 'x_0';
|
||||
$xlabel = $obj->$fieldforxkey;
|
||||
$xvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $xval);
|
||||
if (!empty($object->fields[$xvalwithoutprefix]['arrayofkeyval'])) {
|
||||
$xlabel = $object->fields[$xvalwithoutprefix]['arrayofkeyval'][$obj->$fieldforxkey];
|
||||
}
|
||||
$labeltouse = (($xlabel || $xlabel == '0') ? dol_trunc($xlabel, 20, 'middle') : ($xlabel === '' ? $langs->trans("Empty") : $langs->trans("NotDefined")));
|
||||
|
||||
if ($oldlabeltouse && ($labeltouse != $oldlabeltouse)) {
|
||||
$xi++; // Increase $xi
|
||||
}
|
||||
//var_dump($labeltouse.' '.$oldlabeltouse.' '.$xi);
|
||||
$oldlabeltouse = $labeltouse;
|
||||
|
||||
/* Example of value for $arrayofvaluesforgroupby
|
||||
* array (size=1)
|
||||
* 'g_0' =>
|
||||
* array (size=6)
|
||||
* 0 => string '0' (length=1)
|
||||
* '' => string 'Empty' (length=5)
|
||||
* '__NULL__' => string 'Not defined' (length=11)
|
||||
* 'done' => string 'done' (length=4)
|
||||
* 'processing' => string 'processing' (length=10)
|
||||
* 'undeployed' => string 'undeployed' (length=10)
|
||||
*/
|
||||
foreach ($search_measures as $key => $val) {
|
||||
$gi = 0;
|
||||
foreach ($search_groupby as $gkey) {
|
||||
//var_dump('*** Fetch #'.$ifetch.' for labeltouse='.$labeltouse.' measure number '.$key.' and group g_'.$gi);
|
||||
//var_dump($arrayofvaluesforgroupby);
|
||||
foreach($arrayofvaluesforgroupby['g_'.$gi] as $gvaluepossiblekey => $gvaluepossiblelabel) {
|
||||
$ykeysuffix = $gvaluepossiblelabel;
|
||||
$gvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $gval);
|
||||
|
||||
$fieldfory = 'y_'.$key;
|
||||
$fieldforg = 'g_'.$gi;
|
||||
$fieldforybis = 'y_'.$key.'_'.$ykeysuffix;
|
||||
//var_dump('gvaluepossiblekey='.$gvaluepossiblekey.' gvaluepossiblelabel='.$gvaluepossiblelabel.' ykeysuffix='.$ykeysuffix.' gval='.$gval.' gvalwithoutsuffix='.$gvalwithoutprefix);
|
||||
//var_dump('fieldforg='.$fieldforg.' obj->$fieldforg='.$obj->$fieldforg.' fieldfory='.$fieldfory.' obj->$fieldfory='.$obj->$fieldfory.' fieldforybis='.$fieldforybis);
|
||||
|
||||
if (! is_array($data[$xi])) $data[$xi] = array();
|
||||
|
||||
if (! array_key_exists('label', $data[$xi])) {
|
||||
$data[$xi] = array();
|
||||
$data[$xi]['label'] = $labeltouse;
|
||||
}
|
||||
|
||||
$objfieldforg = $obj->$fieldforg;
|
||||
if (is_null($objfieldforg)) $objfieldforg = '__NULL__';
|
||||
|
||||
if ($gvaluepossiblekey == '0') { // $gvaluepossiblekey can have type int or string. So we create a special if, used when value is '0'
|
||||
//var_dump($objfieldforg.' == \'0\' -> '.($objfieldforg == '0'));
|
||||
if ($objfieldforg == '0') {
|
||||
// The record we fetch is for this group
|
||||
$data[$xi][$fieldforybis] = $obj->$fieldfory;
|
||||
}
|
||||
// The record we fetch is not for this group
|
||||
elseif (! isset($data[$xi][$fieldforybis])) {
|
||||
$data[$xi][$fieldforybis] = '0';
|
||||
}
|
||||
} else {
|
||||
//var_dump((string) $objfieldforg.' === '.(string) $gvaluepossiblekey.' -> '.((string) $objfieldforg === (string) $gvaluepossiblekey));
|
||||
if ((string) $objfieldforg === (string) $gvaluepossiblekey) {
|
||||
// The record we fetch is for this group
|
||||
$data[$xi][$fieldforybis] = $obj->$fieldfory;
|
||||
}
|
||||
// The record we fetch is not for this group
|
||||
elseif (! isset($data[$xi][$fieldforybis])) {
|
||||
$data[$xi][$fieldforybis] = '0';
|
||||
}
|
||||
}
|
||||
}
|
||||
//var_dump($data[$xi]);
|
||||
$gi++;
|
||||
}
|
||||
}
|
||||
} else { // No group by
|
||||
$xval = $search_xaxis[0];
|
||||
$fieldforxkey = 'x_0';
|
||||
$xlabel = $obj->$fieldforxkey;
|
||||
$xvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $xval);
|
||||
|
||||
if (!empty($object->fields[$xvalwithoutprefix]['arrayofkeyval'])) {
|
||||
$xlabel = $object->fields[$xvalwithoutprefix]['arrayofkeyval'][$obj->$fieldforxkey];
|
||||
}
|
||||
|
||||
$labeltouse = (($xlabel || $xlabel == '0') ? dol_trunc($xlabel, 20, 'middle') : ($xlabel === '' ? $langs->trans("Empty") : $langs->trans("NotDefined")));
|
||||
$xarrayforallseries = array('label' => $labeltouse);
|
||||
foreach ($search_measures as $key => $val) {
|
||||
$fieldfory = 'y_'.$key;
|
||||
$xarrayforallseries[$fieldfory] = $obj->$fieldfory;
|
||||
}
|
||||
$data[$xi] = $xarrayforallseries;
|
||||
$xi++;
|
||||
}
|
||||
}
|
||||
|
||||
$totalnbofrecord = count($data);
|
||||
}
|
||||
//var_dump($data);
|
||||
|
||||
|
||||
print '<div class="customreportsoutput'.($totalnbofrecord ? '' : ' customreportsoutputnotdata').'">';
|
||||
|
||||
@ -132,7 +132,7 @@ if (! defined('JS_JQUERY_DISABLE_DROPDOWN'))
|
||||
$(document).bind(\'click\', function (e) {
|
||||
var $clicked = $(e.target); // This is element we click on
|
||||
if (!$clicked.parents().hasClass("dropdown")) {
|
||||
console.log("close dropdown dd ul - we click outside");
|
||||
//console.log("close dropdown dd ul - we click outside");
|
||||
//$(".dropdown dd ul").hide();
|
||||
$(".dropdown dd ul").removeClass("open");
|
||||
|
||||
|
||||
@ -1883,6 +1883,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'tzserver', $outputlang
|
||||
$format = str_replace('%A', '__A__', $format);
|
||||
}
|
||||
|
||||
|
||||
// Analyze date
|
||||
$reg = array();
|
||||
if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
|
||||
@ -3109,15 +3110,14 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
|
||||
if (empty($srconly) && in_array($pictowithouttext, array(
|
||||
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
|
||||
'address', 'barcode', 'bank', 'bookmark', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h',
|
||||
'address', 'barcode', 'bank', 'bookmark', 'building', 'cash-register', 'check', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h',
|
||||
'filter', 'file-code', 'grip', 'grip_title', 'list', 'listlight', 'note',
|
||||
'object_bookmark', 'object_list', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
|
||||
'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'stats',
|
||||
'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', 'globe',
|
||||
'jabber', 'skype', 'twitter', 'facebook', 'linkedin',
|
||||
'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp',
|
||||
'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp',
|
||||
'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top',
|
||||
'home', 'companies', 'products', 'commercial', 'invoicing', 'accountancy', 'project', 'hrm', 'members', 'ticket', 'generic',
|
||||
'home', 'companies', 'products', 'commercial', 'invoicing', 'accountancy', 'preview', 'project', 'hrm', 'members', 'ticket', 'generic',
|
||||
'error', 'warning',
|
||||
'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda'
|
||||
)
|
||||
@ -3133,13 +3133,14 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
}
|
||||
|
||||
$arrayconvpictotofa = array(
|
||||
'address'=> 'address-book', 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accountancy'=>'money-check-alt', 'project'=>'sitemap',
|
||||
'address'=> 'address-book', 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accountancy'=>'money-check-alt',
|
||||
'hrm'=>'umbrella-beach', 'members'=>'users', 'ticket'=>'ticket-alt', 'generic'=>'folder-open',
|
||||
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'object_bookmark'=>'star', 'bookmark'=>'star', 'stats' => 'chart-bar',
|
||||
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'check'=>'check', 'object_bookmark'=>'star', 'bookmark'=>'star', 'stats' => 'chart-bar',
|
||||
'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil', 'filter'=>'filter', 'split'=>'code-branch',
|
||||
'object_list'=>'list-alt', 'object_calendar'=>'calendar-alt', 'object_calendarweek'=>'calendar-week', 'object_calendarmonth'=>'calendar-alt', 'object_calendarday'=>'calendar-day', 'object_calendarperuser'=>'table',
|
||||
'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle',
|
||||
'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt'
|
||||
'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt',
|
||||
'preview'=>'binoculars', 'project'=>'sitemap'
|
||||
);
|
||||
if ($pictowithouttext == 'error' || $pictowithouttext == 'warning') {
|
||||
$facolor = '';
|
||||
@ -3154,6 +3155,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
$morecss .= ($morecss ? ' ' : '').'font-status4';
|
||||
$fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext];
|
||||
}
|
||||
elseif ($pictowithouttext == 'check') {
|
||||
$morecss .= ($morecss ? ' ' : '').'font-status4';
|
||||
$fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext];
|
||||
}
|
||||
elseif ($pictowithouttext == 'off') {
|
||||
$fakey = 'fa-square';
|
||||
$fasize = '1.3em';
|
||||
@ -6016,7 +6021,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
||||
$substitutionarray = array_merge($substitutionarray, array(
|
||||
'__USER_ID__' => (string) $user->id,
|
||||
'__USER_LOGIN__' => (string) $user->login,
|
||||
'__USER_LASTNAME__' => (string) $user->lastname,
|
||||
'__USER_EMAIL__' => (string) $user->email,
|
||||
'__USER_LASTNAME__' => (string) $user->lastname,
|
||||
'__USER_FIRSTNAME__' => (string) $user->firstname,
|
||||
'__USER_FULLNAME__' => (string) $user->getFullName($outputlangs),
|
||||
'__USER_SUPERVISOR_ID__' => (string) ($user->fk_user ? $user->fk_user : '0'),
|
||||
@ -6317,6 +6323,10 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
||||
$substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = $object->getLastMainDocLink($object->element);
|
||||
}
|
||||
else $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = '';
|
||||
|
||||
if (is_object($object) && $object->element == 'propal') $substitutionarray['__URL_PROPOSAL__'] = DOL_MAIN_URL_ROOT . "/comm/propal/card.php?id=" . $object->id;
|
||||
if (is_object($object) && $object->element == 'commande') $substitutionarray['__URL_ORDER__'] = DOL_MAIN_URL_ROOT . "/commande/card.php?id=" . $object->id;
|
||||
if (is_object($object) && $object->element == 'facture') $substitutionarray['__URL_INVOICE__'] = DOL_MAIN_URL_ROOT . "/compta/facture/card.php?id=" . $object->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8609,6 +8619,160 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u
|
||||
return $button;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array with properties of an element.
|
||||
* Called by fetchObjectByElement.
|
||||
*
|
||||
* @param string $element_type Element type (Value of $object->element). Example: 'action', 'facture', 'project_task' or 'object@mymodule'...
|
||||
* @return array (module, classpath, element, subelement, classfile, classname)
|
||||
*/
|
||||
function getElementProperties($element_type)
|
||||
{
|
||||
$regs = array();
|
||||
|
||||
$classfile = $classname = $classpath = '';
|
||||
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$module = $element_type;
|
||||
$element = $element_type;
|
||||
$subelement = $element_type;
|
||||
|
||||
// If we ask an resource form external module (instead of default path)
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i', $element_type, $regs)) {
|
||||
$element = $subelement = $regs[1];
|
||||
$module = $regs[2];
|
||||
}
|
||||
|
||||
//print '<br>1. element : '.$element.' - module : '.$module .'<br>';
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i', $element, $regs)) {
|
||||
$module = $element = $regs[1];
|
||||
$subelement = $regs[2];
|
||||
}
|
||||
|
||||
// For compat
|
||||
if ($element_type == "action") {
|
||||
$classpath = 'comm/action/class';
|
||||
$subelement = 'Actioncomm';
|
||||
$module = 'agenda';
|
||||
}
|
||||
|
||||
// To work with non standard path
|
||||
if ($element_type == 'facture' || $element_type == 'invoice') {
|
||||
$classpath = 'compta/facture/class';
|
||||
$module = 'facture';
|
||||
$subelement = 'facture';
|
||||
}
|
||||
if ($element_type == 'commande' || $element_type == 'order') {
|
||||
$classpath = 'commande/class';
|
||||
$module = 'commande';
|
||||
$subelement = 'commande';
|
||||
}
|
||||
if ($element_type == 'propal') {
|
||||
$classpath = 'comm/propal/class';
|
||||
}
|
||||
if ($element_type == 'supplier_proposal') {
|
||||
$classpath = 'supplier_proposal/class';
|
||||
}
|
||||
if ($element_type == 'shipping') {
|
||||
$classpath = 'expedition/class';
|
||||
$subelement = 'expedition';
|
||||
$module = 'expedition_bon';
|
||||
}
|
||||
if ($element_type == 'delivery') {
|
||||
$classpath = 'livraison/class';
|
||||
$subelement = 'livraison';
|
||||
$module = 'livraison_bon';
|
||||
}
|
||||
if ($element_type == 'contract') {
|
||||
$classpath = 'contrat/class';
|
||||
$module = 'contrat';
|
||||
$subelement = 'contrat';
|
||||
}
|
||||
if ($element_type == 'member') {
|
||||
$classpath = 'adherents/class';
|
||||
$module = 'adherent';
|
||||
$subelement = 'adherent';
|
||||
}
|
||||
if ($element_type == 'cabinetmed_cons') {
|
||||
$classpath = 'cabinetmed/class';
|
||||
$module = 'cabinetmed';
|
||||
$subelement = 'cabinetmedcons';
|
||||
}
|
||||
if ($element_type == 'fichinter') {
|
||||
$classpath = 'fichinter/class';
|
||||
$module = 'ficheinter';
|
||||
$subelement = 'fichinter';
|
||||
}
|
||||
if ($element_type == 'dolresource' || $element_type == 'resource') {
|
||||
$classpath = 'resource/class';
|
||||
$module = 'resource';
|
||||
$subelement = 'dolresource';
|
||||
}
|
||||
if ($element_type == 'propaldet') {
|
||||
$classpath = 'comm/propal/class';
|
||||
$module = 'propal';
|
||||
$subelement = 'propaleligne';
|
||||
}
|
||||
if ($element_type == 'order_supplier') {
|
||||
$classpath = 'fourn/class';
|
||||
$module = 'fournisseur';
|
||||
$subelement = 'commandefournisseur';
|
||||
$classfile = 'fournisseur.commande';
|
||||
}
|
||||
if ($element_type == 'invoice_supplier') {
|
||||
$classpath = 'fourn/class';
|
||||
$module = 'fournisseur';
|
||||
$subelement = 'facturefournisseur';
|
||||
$classfile = 'fournisseur.facture';
|
||||
}
|
||||
if ($element_type == "service") {
|
||||
$classpath = 'product/class';
|
||||
$subelement = 'product';
|
||||
}
|
||||
|
||||
if (empty($classfile)) $classfile = strtolower($subelement);
|
||||
if (empty($classname)) $classname = ucfirst($subelement);
|
||||
if (empty($classpath)) $classpath = $module.'/class';
|
||||
|
||||
$element_properties = array(
|
||||
'module' => $module,
|
||||
'classpath' => $classpath,
|
||||
'element' => $element,
|
||||
'subelement' => $subelement,
|
||||
'classfile' => $classfile,
|
||||
'classname' => $classname
|
||||
);
|
||||
return $element_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch an object from its id and element_type
|
||||
* Inclusion of classes is automatic
|
||||
*
|
||||
* @param int $element_id Element id
|
||||
* @param string $element_type Element type
|
||||
* @param string $element_ref Element ref (Use this or element_id but not both)
|
||||
* @return int|object object || 0 || -1 if error
|
||||
*/
|
||||
function fetchObjectByElement($element_id, $element_type, $element_ref = '')
|
||||
{
|
||||
global $conf, $db;
|
||||
|
||||
$element_prop = getElementProperties($element_type);
|
||||
if (is_array($element_prop) && $conf->{$element_prop['module']}->enabled)
|
||||
{
|
||||
dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php');
|
||||
|
||||
$objecttmp = new $element_prop['classname']($db);
|
||||
$ret = $objecttmp->fetch($element_id, $element_ref);
|
||||
if ($ret >= 0)
|
||||
{
|
||||
return $objecttmp;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if a file can contains executable content
|
||||
*
|
||||
|
||||
@ -2058,157 +2058,6 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array with properties of an element
|
||||
*
|
||||
* @param string $element_type Element type: 'action', 'facture', 'project_task' or 'object@mymodule'...
|
||||
* @return array (module, classpath, element, subelement, classfile, classname)
|
||||
*/
|
||||
function getElementProperties($element_type)
|
||||
{
|
||||
$regs = array();
|
||||
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$module = $element_type;
|
||||
$element = $element_type;
|
||||
$subelement = $element_type;
|
||||
|
||||
// If we ask an resource form external module (instead of default path)
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i', $element_type, $regs)) {
|
||||
$element = $subelement = $regs[1];
|
||||
$module = $regs[2];
|
||||
}
|
||||
|
||||
//print '<br>1. element : '.$element.' - module : '.$module .'<br>';
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i', $element, $regs)) {
|
||||
$module = $element = $regs[1];
|
||||
$subelement = $regs[2];
|
||||
}
|
||||
|
||||
// For compat
|
||||
if ($element_type == "action") {
|
||||
$classpath = 'comm/action/class';
|
||||
$subelement = 'Actioncomm';
|
||||
$module = 'agenda';
|
||||
}
|
||||
|
||||
// To work with non standard path
|
||||
if ($element_type == 'facture' || $element_type == 'invoice') {
|
||||
$classpath = 'compta/facture/class';
|
||||
$module = 'facture';
|
||||
$subelement = 'facture';
|
||||
}
|
||||
if ($element_type == 'commande' || $element_type == 'order') {
|
||||
$classpath = 'commande/class';
|
||||
$module = 'commande';
|
||||
$subelement = 'commande';
|
||||
}
|
||||
if ($element_type == 'propal') {
|
||||
$classpath = 'comm/propal/class';
|
||||
}
|
||||
if ($element_type == 'supplier_proposal') {
|
||||
$classpath = 'supplier_proposal/class';
|
||||
}
|
||||
if ($element_type == 'shipping') {
|
||||
$classpath = 'expedition/class';
|
||||
$subelement = 'expedition';
|
||||
$module = 'expedition_bon';
|
||||
}
|
||||
if ($element_type == 'delivery') {
|
||||
$classpath = 'livraison/class';
|
||||
$subelement = 'livraison';
|
||||
$module = 'livraison_bon';
|
||||
}
|
||||
if ($element_type == 'contract') {
|
||||
$classpath = 'contrat/class';
|
||||
$module = 'contrat';
|
||||
$subelement = 'contrat';
|
||||
}
|
||||
if ($element_type == 'member') {
|
||||
$classpath = 'adherents/class';
|
||||
$module = 'adherent';
|
||||
$subelement = 'adherent';
|
||||
}
|
||||
if ($element_type == 'cabinetmed_cons') {
|
||||
$classpath = 'cabinetmed/class';
|
||||
$module = 'cabinetmed';
|
||||
$subelement = 'cabinetmedcons';
|
||||
}
|
||||
if ($element_type == 'fichinter') {
|
||||
$classpath = 'fichinter/class';
|
||||
$module = 'ficheinter';
|
||||
$subelement = 'fichinter';
|
||||
}
|
||||
if ($element_type == 'dolresource' || $element_type == 'resource') {
|
||||
$classpath = 'resource/class';
|
||||
$module = 'resource';
|
||||
$subelement = 'dolresource';
|
||||
}
|
||||
if ($element_type == 'propaldet') {
|
||||
$classpath = 'comm/propal/class';
|
||||
$module = 'propal';
|
||||
$subelement = 'propaleligne';
|
||||
}
|
||||
if ($element_type == 'order_supplier') {
|
||||
$classpath = 'fourn/class';
|
||||
$module = 'fournisseur';
|
||||
$subelement = 'commandefournisseur';
|
||||
$classfile = 'fournisseur.commande';
|
||||
}
|
||||
if ($element_type == 'invoice_supplier') {
|
||||
$classpath = 'fourn/class';
|
||||
$module = 'fournisseur';
|
||||
$subelement = 'facturefournisseur';
|
||||
$classfile = 'fournisseur.facture';
|
||||
}
|
||||
if ($element_type == "service") {
|
||||
$classpath = 'product/class';
|
||||
$subelement = 'product';
|
||||
}
|
||||
|
||||
if (!isset($classfile)) $classfile = strtolower($subelement);
|
||||
if (!isset($classname)) $classname = ucfirst($subelement);
|
||||
if (!isset($classpath)) $classpath = $module.'/class';
|
||||
|
||||
$element_properties = array(
|
||||
'module' => $module,
|
||||
'classpath' => $classpath,
|
||||
'element' => $element,
|
||||
'subelement' => $subelement,
|
||||
'classfile' => $classfile,
|
||||
'classname' => $classname
|
||||
);
|
||||
return $element_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch an object from its id and element_type
|
||||
* Inclusion of classes is automatic
|
||||
*
|
||||
* @param int $element_id Element id
|
||||
* @param string $element_type Element type
|
||||
* @param string $element_ref Element ref (Use this or element_id but not both)
|
||||
* @return int|object object || 0 || -1 if error
|
||||
*/
|
||||
function fetchObjectByElement($element_id, $element_type, $element_ref = '')
|
||||
{
|
||||
global $conf, $db;
|
||||
|
||||
$element_prop = getElementProperties($element_type);
|
||||
if (is_array($element_prop) && $conf->{$element_prop['module']}->enabled)
|
||||
{
|
||||
dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php');
|
||||
|
||||
$objecttmp = new $element_prop['classname']($db);
|
||||
$ret = $objecttmp->fetch($element_id, $element_ref);
|
||||
if ($ret >= 0)
|
||||
{
|
||||
return $objecttmp;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert an array with RGB value into hex RGB value.
|
||||
@ -2377,7 +2226,7 @@ function colorLighten($hex, $percent)
|
||||
/**
|
||||
* @param string $hex color in hex
|
||||
* @param float $alpha 0 to 1 to add alpha channel
|
||||
* @param bool $returnArray Array set to 1 to return an array instead of string
|
||||
* @param bool $returnArray true=return an array instead, false=return string
|
||||
* @return string|array String or array
|
||||
*/
|
||||
function colorHexToRgb($hex, $alpha = false, $returnArray = false)
|
||||
|
||||
@ -196,8 +196,13 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
|
||||
// Get more permissions checks from hooks
|
||||
$parameters = array('features'=>$features, 'objectid'=>$objectid, 'idtype'=>$dbt_select);
|
||||
$reshook = $hookmanager->executeHooks('restrictedArea', $parameters);
|
||||
if (!empty($hookmanager->resArray['result'])) return true;
|
||||
if ($reshook > 0) return false;
|
||||
|
||||
if (isset($hookmanager->resArray['result'])) {
|
||||
if ($hookmanager->resArray['result'] == 0) accessforbidden(); // Module returns 0, so access forbidden
|
||||
}
|
||||
if ($reshook > 0) { // No other test done.
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ($dbt_select != 'rowid' && $dbt_select != 'id') $objectid = "'".$objectid."'";
|
||||
|
||||
|
||||
@ -51,11 +51,14 @@ function dolStripPhpCode($str, $replacewith = '')
|
||||
$partlings = explode('?>', $part);
|
||||
if (!empty($partlings))
|
||||
{
|
||||
$phppart = $partlings[0];
|
||||
//$phppart = $partlings[0];
|
||||
//remove content before closing tag
|
||||
if (count($partlings) > 1) $partlings[0] = ''; // Todo why a count > 1 and not >= 1 ?
|
||||
//append to out string
|
||||
$newstr .= '<span class="phptag" class="tooltip" title="'.dol_escape_htmltag(dolGetFirstLineOfText($phppart).'...').'">'.$replacewith.'<!-- '.$phppart.' --></span>'.implode('', $partlings);
|
||||
//$newstr .= '<span class="phptag" class="tooltip" title="'.dol_escape_htmltag(dolGetFirstLineOfText($phppart).'...').'">'.$replacewith.'<!-- '.$phppart.' --></span>'.implode('', $partlings);
|
||||
//$newstr .= '<span>'.$replacewith.'<!-- '.$phppart.' --></span>'.implode('', $partlings);
|
||||
$newstr .= '<span phptag>'.$replacewith.'</span>'.implode('', $partlings);
|
||||
//$newstr .= $replacewith.implode('', $partlings);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,15 +166,15 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0, $c
|
||||
$content = str_replace('href="'.DOL_URL_ROOT.'/document.php', 'href="!~!~!~'.DOL_URL_ROOT.'/document.php', $content);
|
||||
|
||||
// Replace relative link '/' with dolibarr URL
|
||||
$content = preg_replace('/(href=")\/\"/', '\1!~!~!~'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(href=")\/(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'\2"', $content, -1, $nbrep);
|
||||
// Replace relative link /xxx.php#aaa or /xxx.php with dolibarr URL (we discard param ?...)
|
||||
$content = preg_replace('/(href=")\/?([^:\"\!]*)\.php(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2\3"', $content, -1, $nbrep);
|
||||
// Replace relative link /xxx.php?a=b&c=d#aaa or /xxx.php?a=b&c=d with dolibarr URL
|
||||
$content = preg_replace('/(href=")\/?([^:\"\!]*)\.php\?([^#\"<>]*)(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2&\3\4"', $content, -1, $nbrep);
|
||||
|
||||
// Fix relative link into medias with correct URL after the DOL_URL_ROOT: ../url("medias/
|
||||
$content = preg_replace('/url\((["\']?)medias\//', 'url(\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
$content = preg_replace('/data-slide-bg=(["\']?)medias\//', 'data-slide-bg=\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
$content = preg_replace('/url\((["\']?)\/?medias\//', 'url(\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
$content = preg_replace('/data-slide-bg=(["\']?)\/?medias\//', 'data-slide-bg=\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
|
||||
// <img src="medias/...image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
|
||||
// <img src="...image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
|
||||
@ -269,8 +272,8 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
|
||||
$content = preg_replace('/(url\(")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
|
||||
|
||||
// Fix relative link into medias with correct URL after the DOL_URL_ROOT: ../url("medias/
|
||||
$content = preg_replace('/url\((["\']?)medias\//', 'url(\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
$content = preg_replace('/data-slide-bg=(["\']?)medias\//', 'data-slide-bg=\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
$content = preg_replace('/url\((["\']?)\/?medias\//', 'url(\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
$content = preg_replace('/data-slide-bg=(["\']?)\/?medias\//', 'data-slide-bg=\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
|
||||
// <img src="medias/...image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
|
||||
// <img src="...image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
|
||||
|
||||
@ -116,7 +116,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
|
||||
dol_delete_file($filetpl);
|
||||
|
||||
$shortlangcode = '';
|
||||
if ($objectpage->lang) $shortlangcode = preg_replace('/[_-].*$/', '', $objectpage->lang); // en_US or en-US -> en
|
||||
if ($objectpage->lang) $shortlangcode = substr($objectpage->lang, 0, 2); // en_US or en-US -> en
|
||||
|
||||
$tplcontent = '';
|
||||
$tplcontent .= "<?php // BEGIN PHP\n";
|
||||
@ -148,7 +148,8 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
|
||||
// Add translation reference (main language)
|
||||
if ($object->isMultiLang()) {
|
||||
// Add myself
|
||||
$tplcontent .= '<link rel="alternate" hreflang="'.$shortlangcode.'" href="'.($object->fk_default_home == $objectpage->id ? '/' : '/'.$shortlangcode.'/'.$objectpage->pageurl.'.php').'" />'."\n";
|
||||
$tplcontent .= '<link rel="alternate" hreflang="'.$shortlangcode.'" href="'.(($object->fk_default_home == $objectpage->id) ? '/' : (($shortlangcode != substr($object->lang, 0, 2) ? '/'.$shortlangcode : '')).'/'.$objectpage->pageurl.'.php').'" />'."\n";
|
||||
|
||||
// Add page "translation of"
|
||||
$translationof = $objectpage->fk_page;
|
||||
if ($translationof) {
|
||||
@ -183,7 +184,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
|
||||
else dol_print_error($db);
|
||||
}
|
||||
// Add canonical reference
|
||||
$tplcontent .= '<link href="/'.(($objectpage->id == $object->fk_default_home) ? '' : $shortlangcode.'/'.($objectpage->pageurl.'.php')).'" rel="canonical" />'."\n";
|
||||
$tplcontent .= '<link href="'.(($objectpage->id == $object->fk_default_home) ? '/' : (($shortlangcode != substr($object->lang, 0, 2) ? '/'.$shortlangcode : '') .'/'.$objectpage->pageurl.'.php')).'" rel="canonical" />'."\n";
|
||||
// Add manifest.json on homepage
|
||||
$tplcontent .= '<?php if ($website->use_manifest) { print \'<link rel="manifest" href="/manifest.json.php" />\'."\n"; } ?>'."\n";
|
||||
$tplcontent .= '<!-- Include link to CSS file -->'."\n";
|
||||
|
||||
@ -281,7 +281,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
-- Balance
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2435__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__);
|
||||
-- Export accounting documents
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2436__+MAX_llx_menu__, 'accountancy', 'accountancy_files', 2400__+MAX_llx_menu__, '/compta/compta-files.php?mainmenu=accountancy&leftmenu=accountancy_files', 'AccountantFiles', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 17, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2436__+MAX_llx_menu__, 'accountancy', 'accountancy_files', 2400__+MAX_llx_menu__, '/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files', 'AccountantFiles', 1, 'accountancy', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 0, 17, __ENTITY__);
|
||||
-- Reports
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2440__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2400__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'MenuReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __ENTITY__);
|
||||
|
||||
@ -984,7 +984,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
$newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201);
|
||||
$newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire, '', '', '', 202);
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) $newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ListOfTemplates"), 1, $user->rights->ficheinter->lire, '', '', '', 203);
|
||||
$newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire);
|
||||
$newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->ficheinter->lire);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1372,7 +1372,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
if (!empty($conf->comptabilite->enabled))
|
||||
{
|
||||
// Files
|
||||
if ((!empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 1) || !empty($conf->global->ACCOUNTANCY_SHOW_EXPORT_FILES_MENU))
|
||||
if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU))
|
||||
{
|
||||
$newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'files');
|
||||
}
|
||||
|
||||
@ -546,9 +546,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
|
||||
$pdf->rollbackTransaction(true);
|
||||
|
||||
$iniY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$curY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight;
|
||||
|
||||
// Loop on each lines
|
||||
$pageposbeforeprintlines = $pdf->getPage();
|
||||
@ -567,12 +565,9 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
|
||||
$pageposbefore = $pdf->getPage();
|
||||
|
||||
// Description of product line
|
||||
$curX = $this->posxdesc - 1;
|
||||
|
||||
$showpricebeforepagebreak = 1;
|
||||
$posYAfterImage = 0;
|
||||
$posYAfterDescription = 0;
|
||||
|
||||
if ($this->getColumnStatus('photo'))
|
||||
{
|
||||
@ -603,15 +598,18 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
if ($this->getColumnStatus('desc'))
|
||||
{
|
||||
$pdf->startTransaction();
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
$pageposafter = $pdf->getPage();
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||
{
|
||||
$pdf->rollbackTransaction(true);
|
||||
$pageposafter = $pageposbefore;
|
||||
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
$pageposafter = $pdf->getPage();
|
||||
$posyafter = $pdf->GetY();
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text
|
||||
@ -638,7 +636,6 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
{
|
||||
$pdf->commitTransaction();
|
||||
}
|
||||
$posYAfterDescription = $pdf->GetY();
|
||||
}
|
||||
|
||||
|
||||
@ -775,11 +772,10 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
|
||||
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
|
||||
$pdf->SetLineStyle(array('dash'=>0));
|
||||
}
|
||||
|
||||
$nexY += 2; // Add space between lines
|
||||
|
||||
// Detect if some page were added automatically and output _tableau for past pages
|
||||
while ($pagenb < $pageposafter)
|
||||
@ -1691,7 +1687,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
// Default field style for content
|
||||
$this->defaultContentsFieldsStyle = array(
|
||||
'align' => 'R', // R,C,L
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
);
|
||||
|
||||
// Default field style for content
|
||||
@ -1728,10 +1724,11 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
'align' => 'L',
|
||||
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
|
||||
// 'label' => ' ', // the final label
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
'content' => array(
|
||||
'align' => 'L',
|
||||
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@ -418,9 +418,7 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
$pdf->rollbackTransaction(true);
|
||||
|
||||
|
||||
$iniY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$curY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight;
|
||||
|
||||
// Loop on each lines
|
||||
for ($i = 0; $i < $nblines; $i++)
|
||||
@ -473,15 +471,15 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
if ($this->getColumnStatus('desc'))
|
||||
{
|
||||
$pdf->startTransaction();
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
$pageposafter = $pdf->getPage();
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||
{
|
||||
$pdf->rollbackTransaction(true);
|
||||
$pageposafter = $pageposbefore;
|
||||
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
$posyafter = $pdf->GetY();
|
||||
@ -582,16 +580,13 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
}
|
||||
}
|
||||
|
||||
$nexY += 3;
|
||||
if ($weighttxt && $voltxt) $nexY += 2;
|
||||
|
||||
// Add line
|
||||
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
|
||||
{
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY - 1, $this->page_largeur - $this->marge_droite, $nexY - 1);
|
||||
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
|
||||
$pdf->SetLineStyle(array('dash'=>0));
|
||||
}
|
||||
|
||||
@ -1121,7 +1116,7 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
// Default field style for content
|
||||
$this->defaultContentsFieldsStyle = array(
|
||||
'align' => 'R', // R,C,L
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
);
|
||||
|
||||
// Default field style for content
|
||||
@ -1158,10 +1153,10 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
'align' => 'L',
|
||||
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
|
||||
// 'label' => ' ', // the final label
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
'content' => array(
|
||||
'align' => 'L',
|
||||
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@ -582,9 +582,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
|
||||
$pdf->rollbackTransaction(true);
|
||||
|
||||
$iniY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$curY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight;
|
||||
|
||||
// Loop on each lines
|
||||
$pageposbeforeprintlines = $pdf->getPage();
|
||||
@ -605,7 +603,6 @@ class pdf_sponge extends ModelePDFFactures
|
||||
|
||||
$showpricebeforepagebreak = 1;
|
||||
$posYAfterImage = 0;
|
||||
$posYAfterDescription = 0;
|
||||
|
||||
if ($this->getColumnStatus('photo'))
|
||||
{
|
||||
@ -637,13 +634,17 @@ class pdf_sponge extends ModelePDFFactures
|
||||
if ($this->getColumnStatus('desc'))
|
||||
{
|
||||
$pdf->startTransaction();
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
$pageposafter = $pdf->getPage();
|
||||
|
||||
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||
{
|
||||
$pdf->rollbackTransaction(true);
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
$posyafter = $pdf->GetY();
|
||||
//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
|
||||
@ -670,10 +671,9 @@ class pdf_sponge extends ModelePDFFactures
|
||||
{
|
||||
$pdf->commitTransaction();
|
||||
}
|
||||
$posYAfterDescription = $pdf->GetY();
|
||||
}
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
$nexY = $pdf->GetY();
|
||||
$pageposafter = $pdf->getPage();
|
||||
$pdf->setPage($pageposbefore);
|
||||
$pdf->setTopMargin($this->marge_haute);
|
||||
@ -823,12 +823,10 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
|
||||
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
|
||||
$pdf->SetLineStyle(array('dash'=>0));
|
||||
}
|
||||
|
||||
$nexY += 2; // Add space between lines
|
||||
|
||||
// Detect if some page were added automatically and output _tableau for past pages
|
||||
while ($pagenb < $pageposafter) {
|
||||
$pdf->setPage($pagenb);
|
||||
@ -2216,7 +2214,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
// Default field style for content
|
||||
$this->defaultContentsFieldsStyle = array(
|
||||
'align' => 'R', // R,C,L
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
);
|
||||
|
||||
// Default field style for content
|
||||
@ -2257,6 +2255,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
),
|
||||
'content' => array(
|
||||
'align' => 'L',
|
||||
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ class modFournisseur extends DolibarrModules
|
||||
|
||||
// Dependencies
|
||||
$this->depends = array("modSociete");
|
||||
$this->requiredby = array();
|
||||
$this->requiredby = array("modSupplierProposal");
|
||||
$this->langfiles = array('bills', 'companies', 'suppliers', 'orders', 'sendings');
|
||||
|
||||
// Config pages
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
* 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>
|
||||
*
|
||||
* 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
|
||||
@ -181,6 +182,7 @@ class modProduct extends DolibarrModules
|
||||
'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",
|
||||
'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",
|
||||
@ -203,8 +205,9 @@ class modProduct 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.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.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',
|
||||
@ -315,6 +318,7 @@ class modProduct extends DolibarrModules
|
||||
'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",
|
||||
'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",
|
||||
@ -325,7 +329,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_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.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",
|
||||
@ -337,7 +342,8 @@ class modProduct extends DolibarrModules
|
||||
$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.note'=>"virtualproduct",'p.length'=>"virtualproduct",
|
||||
'p.accountancy_code_buy'=>'virtualproduct','p.accountancy_code_buy_intra'=>'virtualproduct','p.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",
|
||||
'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct"
|
||||
@ -384,6 +390,8 @@ class modProduct extends DolibarrModules
|
||||
'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",
|
||||
'p.note_public' => "NotePublic",
|
||||
'p.note' => "NotePrivate",
|
||||
'p.weight' => "Weight",
|
||||
@ -533,6 +541,8 @@ class modProduct extends DolibarrModules
|
||||
'p.accountancy_code_sell_intra' => "",
|
||||
'p.accountancy_code_sell_export' => "",
|
||||
'p.accountancy_code_buy' => "",
|
||||
'p.accountancy_code_buy_intra' => "",
|
||||
'p.accountancy_code_buy_export' => "",
|
||||
'p.weight' => "",
|
||||
'p.weight_units' => 'kg', // Use a unit of measure from the dictionary. g/Kg/T etc....matches field "Short label" for unit type "weight" in table "' . MAIN_DB_PREFIX . 'c_units',
|
||||
'p.length' => "",
|
||||
|
||||
@ -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) 2020 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
|
||||
@ -148,6 +149,7 @@ class modService extends DolibarrModules
|
||||
'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",
|
||||
'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",
|
||||
@ -171,6 +173,7 @@ class modService extends DolibarrModules
|
||||
'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.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',
|
||||
@ -283,6 +286,7 @@ class modService extends DolibarrModules
|
||||
'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",
|
||||
'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",
|
||||
@ -293,7 +297,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_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.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",
|
||||
@ -305,7 +310,8 @@ class modService extends DolibarrModules
|
||||
$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.note'=>"virtualproduct",'p.length'=>"virtualproduct",
|
||||
'p.accountancy_code_buy'=>'virtualproduct','p.accountancy_code_buy_intra'=>'virtualproduct','p.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",
|
||||
'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct"
|
||||
@ -353,6 +359,8 @@ class modService extends DolibarrModules
|
||||
'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",
|
||||
'p.note_public' => "NotePublic",
|
||||
'p.note' => "NotePrivate",
|
||||
'p.weight' => "Weight",
|
||||
@ -500,6 +508,8 @@ class modService extends DolibarrModules
|
||||
'p.accountancy_code_sell_intra' => "",
|
||||
'p.accountancy_code_sell_export' => "",
|
||||
'p.accountancy_code_buy' => "",
|
||||
'p.accountancy_code_buy_intra' => "",
|
||||
'p.accountancy_code_buy_export' => "",
|
||||
'p.weight' => "",
|
||||
'p.weight_units' => 'kg', // Use a unit of measure from the dictionary. g/Kg/T etc....matches field "Short label" for unit type "weight" in table "' . MAIN_DB_PREFIX . 'c_units',
|
||||
'p.length' => "",
|
||||
|
||||
@ -564,9 +564,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
|
||||
$pdf->rollbackTransaction(true);
|
||||
|
||||
$iniY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$curY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight + 2;
|
||||
$nexY = $tab_top + $this->tabTitleHeight;
|
||||
|
||||
// Loop on each lines
|
||||
$pageposbeforeprintlines = $pdf->getPage();
|
||||
@ -621,15 +619,17 @@ class pdf_cyan extends ModelePDFPropales
|
||||
if ($this->getColumnStatus('desc'))
|
||||
{
|
||||
$pdf->startTransaction();
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
$pageposafter = $pdf->getPage();
|
||||
|
||||
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||
{
|
||||
$pdf->rollbackTransaction(true);
|
||||
$pageposafter = $pageposbefore;
|
||||
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
$posyafter = $pdf->GetY();
|
||||
@ -794,11 +794,11 @@ class pdf_cyan extends ModelePDFPropales
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
|
||||
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
|
||||
$pdf->SetLineStyle(array('dash'=>0));
|
||||
}
|
||||
|
||||
$nexY += 2; // Add space between lines
|
||||
|
||||
|
||||
// Detect if some page were added automatically and output _tableau for past pages
|
||||
while ($pagenb < $pageposafter)
|
||||
@ -1840,7 +1840,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
// Default field style for content
|
||||
$this->defaultContentsFieldsStyle = array(
|
||||
'align' => 'R', // R,C,L
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
);
|
||||
|
||||
// Default field style for content
|
||||
@ -1877,10 +1877,11 @@ class pdf_cyan extends ModelePDFPropales
|
||||
'align' => 'L',
|
||||
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
|
||||
// 'label' => ' ', // the final label
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
'content' => array(
|
||||
'align' => 'L',
|
||||
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@ -496,9 +496,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
$height_note = 0;
|
||||
}
|
||||
|
||||
$iniY = $tab_top + 7;
|
||||
$curY = $tab_top + 7;
|
||||
$nexY = $tab_top + 7;
|
||||
$nexY = $tab_top + 5;
|
||||
|
||||
// Use new auto collum system
|
||||
$this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
@ -555,15 +553,15 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
if ($this->getColumnStatus('desc'))
|
||||
{
|
||||
$pdf->startTransaction();
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc, 1);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||
{
|
||||
$pdf->rollbackTransaction(true);
|
||||
$pageposafter = $pageposbefore;
|
||||
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
|
||||
|
||||
$this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc, 1);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
$posyafter = $pdf->GetY();
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text
|
||||
@ -724,12 +722,10 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
|
||||
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
|
||||
$pdf->SetLineStyle(array('dash'=>0));
|
||||
}
|
||||
|
||||
$nexY += 2; // Add space between lines
|
||||
|
||||
// Detect if some page were added automatically and output _tableau for past pages
|
||||
while ($pagenb < $pageposafter)
|
||||
{
|
||||
@ -1483,7 +1479,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
// Default field style for content
|
||||
$this->defaultContentsFieldsStyle = array(
|
||||
'align' => 'R', // R,C,L
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
);
|
||||
|
||||
// Default field style for content
|
||||
@ -1520,10 +1516,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
'align' => 'L',
|
||||
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
|
||||
// 'label' => ' ', // the final label
|
||||
'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
'content' => array(
|
||||
'align' => 'L',
|
||||
'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@ -198,7 +198,7 @@ $langs->load("modulebuilder");
|
||||
</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo GETPOST('list', 'int')!='' ? GETPOST('list', 'int') : '1'; ?>"></td></tr>
|
||||
<!-- Visibility for PDF-->
|
||||
<tr><td class="extra_pdf"><?php echo $form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?>
|
||||
</td><td class="valeur"><input id="printable" type="checkbox" name="printable"<?php echo GETPOST('printable', 'alpha')?' checked':''; ?>></td></tr>
|
||||
</td><td class="valeur"><input id="printable" class="minwidth100" type="text" name="printable" value="<?php echo dol_escape_htmltag(GETPOST('printable', 'int')); ?>"></td></tr>
|
||||
<!-- Totalizable -->
|
||||
<tr class="extra_totalizable"><td><?php echo $langs->trans("Totalizable"); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo ((GETPOST('totalizable', 'alpha') || GETPOST('button', 'alpha'))?' checked':''); ?>></td></tr>
|
||||
<!-- Help tooltip -->
|
||||
|
||||
@ -267,7 +267,7 @@ else
|
||||
</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo ($list!=''?$list:'1'); ?>"></td></tr>
|
||||
<!-- Visibility for PDF-->
|
||||
<tr><td class="extra_pdf"><?php echo $form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?>
|
||||
</td><td class="valeur"><input id="printable" type="checkbox" name="printable"<?php echo !empty($printable)?' checked':''; ?>></td></tr>
|
||||
</td><td class="valeur"><input id="printable" class="minwidth100" type="text" name="printable" value="<?php echo dol_escape_htmltag($printable); ?>"></td></tr>
|
||||
<tr class="extra_totalizable"><td><?php echo $form->textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo ($totalizable?' checked':''); ?>></td></tr>
|
||||
<!-- Help tooltip -->
|
||||
<tr class="help"><td><?php echo $form->textwithpicto($langs->trans("HelpOnTooltip"), $langs->trans("HelpOnTooltipDesc")); ?></td><td class="valeur"><input id="help" class="quatrevingtpercent" type="text" name="help" value="<?php echo dol_escape_htmltag($help); ?>"></td></tr>
|
||||
|
||||
@ -93,7 +93,7 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel
|
||||
print '<td class="center">'.yn($extrafields->attributes[$elementtype]['required'][$key])."</td>\n";
|
||||
print '<td class="center">'.yn($extrafields->attributes[$elementtype]['alwayseditable'][$key])."</td>\n";
|
||||
print '<td class="center">'.$extrafields->attributes[$elementtype]['list'][$key]."</td>\n";
|
||||
print '<td class="center">'.yn($extrafields->attributes[$elementtype]['printable'][$key])."</td>\n";
|
||||
print '<td class="center">'.$extrafields->attributes[$elementtype]['printable'][$key]."</td>\n";
|
||||
print '<td class="center">'.yn($extrafields->attributes[$elementtype]['totalizable'][$key])."</td>\n";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
print '<td class="center">';
|
||||
|
||||
@ -28,7 +28,6 @@ if (empty($object) || !is_object($object))
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
|
||||
@ -66,8 +65,9 @@ $userstatic = new User($db);
|
||||
<div class="tagtable tableforcontact centpercent noborder nobordertop allwidth">
|
||||
|
||||
<?php
|
||||
if ($permission) {
|
||||
?>
|
||||
if ($permission)
|
||||
{
|
||||
?>
|
||||
<form class="tagtr liste_titre">
|
||||
<div class="tagtd liste_titre"><?php echo $langs->trans("NatureOfContact"); ?></div>
|
||||
<div class="tagtd liste_titre"><?php echo $langs->trans("ThirdParty"); ?></div>
|
||||
@ -153,94 +153,164 @@ if ($permission) {
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<form class="tagtr liste_titre liste_titre_add formnoborder">
|
||||
<div class="tagtd liste_titre"><?php echo $langs->trans("NatureOfContact"); ?></div>
|
||||
<div class="tagtd liste_titre"><?php echo $langs->trans("ThirdParty"); ?></div>
|
||||
<div class="tagtd liste_titre"><?php echo $langs->trans("Users").'/'.$langs->trans("Contacts"); ?></div>
|
||||
<div class="tagtd liste_titre"><?php echo $langs->trans("ContactType"); ?></div>
|
||||
<div class="tagtd liste_titre center"><?php echo $langs->trans("Status"); ?></div>
|
||||
<div class="tagtd liste_titre"> </div>
|
||||
</form>
|
||||
print "</div>";
|
||||
|
||||
<?php
|
||||
$arrayofsource=array('internal','external'); // Show both link to user and thirdparties contacts
|
||||
foreach($arrayofsource as $source) {
|
||||
$tmpobject=$object;
|
||||
if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc;
|
||||
/**
|
||||
* Prepare list
|
||||
*/
|
||||
|
||||
// TODO: replace this with direct SQL string to use $db->sort($sortfield, $sortorder)
|
||||
$list = array();
|
||||
foreach(array('internal', 'external') as $source)
|
||||
{
|
||||
$tmpobject = $object;
|
||||
|
||||
if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc))
|
||||
{
|
||||
$tmpobject = $objectsrc;
|
||||
}
|
||||
|
||||
$tab = $tmpobject->liste_contact(-1, $source);
|
||||
$num=count($tab);
|
||||
$num = count($tab);
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
?>
|
||||
while ($i < $num)
|
||||
{
|
||||
$entry = new stdClass();
|
||||
|
||||
$entry->id = $tab[$i]['rowid'];
|
||||
$entry->type = $tab[$i]['libelle'];
|
||||
|
||||
if ($tab[$i]['source'] == 'internal')
|
||||
{
|
||||
$entry->nature = $langs->trans("User");
|
||||
}
|
||||
elseif ($tab[$i]['source'] == 'external')
|
||||
{
|
||||
$entry->nature = $langs->trans("ThirdPartyContact");
|
||||
}
|
||||
|
||||
<form class="tagtr oddeven">
|
||||
<div class="tagtd left">
|
||||
<?php if ($tab[$i]['source']=='internal') echo $langs->trans("User"); ?>
|
||||
<?php if ($tab[$i]['source']=='external') echo $langs->trans("ThirdPartyContact"); ?>
|
||||
</div>
|
||||
<div class="tagtd left">
|
||||
<?php
|
||||
if ($tab[$i]['socid'] > 0)
|
||||
{
|
||||
$companystatic->fetch($tab[$i]['socid']);
|
||||
echo $companystatic->getNomUrl(1);
|
||||
$entry->thirdparty = $companystatic->getNomUrl(1);
|
||||
}
|
||||
if ($tab[$i]['socid'] < 0)
|
||||
elseif ($tab[$i]['socid'] < 0)
|
||||
{
|
||||
echo $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
$entry->thirdparty = $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
}
|
||||
if (! $tab[$i]['socid'])
|
||||
elseif (! $tab[$i]['socid'])
|
||||
{
|
||||
echo ' ';
|
||||
$entry->thirdparty = "";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="tagtd">
|
||||
<?php
|
||||
$statusofcontact = $tab[$i]['status'];
|
||||
|
||||
if ($tab[$i]['source']=='internal')
|
||||
{
|
||||
$userstatic->fetch($tab[$i]['id']);
|
||||
echo $userstatic->getNomUrl(-1, '', 0, 0, 0, 0, '', 'valignmiddle');
|
||||
$entry->contact = $userstatic->getNomUrl(-1, '', 0, 0, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
if ($tab[$i]['source']=='external')
|
||||
elseif ($tab[$i]['source']=='external')
|
||||
{
|
||||
$contactstatic->fetch($tab[$i]['id']);
|
||||
echo $contactstatic->getNomUrl(1, '', 0, '', 0, 0);
|
||||
$entry->contact =$contactstatic->getNomUrl(1, '', 0, '', 0, 0);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="tagtd"><?php echo $tab[$i]['libelle']; ?></div>
|
||||
<div class="tagtd center">
|
||||
<?php //if ($object->statut >= 0) echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=swapstatut&ligne='.$tab[$i]['rowid'].'">';
|
||||
|
||||
if ($tab[$i]['source']=='internal')
|
||||
{
|
||||
echo $userstatic->LibStatut($tab[$i]['statuscontact'], 3);
|
||||
$entry->status = $userstatic->LibStatut($tab[$i]['statuscontact'], 3);
|
||||
}
|
||||
if ($tab[$i]['source']=='external')
|
||||
elseif ($tab[$i]['source']=='external')
|
||||
{
|
||||
echo $contactstatic->LibStatut($tab[$i]['statuscontact'], 3);
|
||||
$entry->status = $contactstatic->LibStatut($tab[$i]['statuscontact'], 3);
|
||||
}
|
||||
//if ($object->statut >= 0) echo '</a>'; ?>
|
||||
</div>
|
||||
<div class="tagtd nowrap right">
|
||||
<?php if ($permission) { ?>
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deletecontact&lineid='.$tab[$i]['rowid']; ?>"><?php echo img_picto($langs->trans('Unlink'), 'unlink'); ?></a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php $i++;
|
||||
$i++;
|
||||
$list[] = $entry;
|
||||
}
|
||||
}
|
||||
|
||||
print "</div>\n";
|
||||
print "</div>\n";
|
||||
|
||||
$sortfield = GETPOST("sortfield", "alpha");
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
|
||||
if (!$sortfield) $sortfield = "nature";
|
||||
if (!$sortorder) $sortorder = "asc";
|
||||
|
||||
// Re-sort list
|
||||
$list = dol_sort_array($list, $sortfield, $sortorder, 1, 0, 1);
|
||||
|
||||
$arrayfields = array(
|
||||
'rowid' => array('label'=>$langs->trans("Id"), 'checked'=>1),
|
||||
'nature' => array('label'=>$langs->trans("NatureOfContact"), 'checked'=>1),
|
||||
'thirdparty' => array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
||||
'contact' => array('label'=>$langs->trans("Users").'/'.$langs->trans("Contacts"), 'checked'=>1),
|
||||
'type' => array('label'=>$langs->trans("ContactType"), 'checked'=>1),
|
||||
'status' => array('label'=>$langs->trans("Status"), 'checked'=>1),
|
||||
'link' => array('label'=>$langs->trans("Link"), 'checked'=>1),
|
||||
);
|
||||
|
||||
$param = 'id='.$object->id.'&mainmenu=home';
|
||||
|
||||
/**
|
||||
* Show list
|
||||
*/
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print '<table class="tagtable nobottomiftotal liste">';
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($arrayfields['nature']['label'], $_SERVER["PHP_SELF"], "nature", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['thirdparty']['label'], $_SERVER["PHP_SELF"], "thirdparty", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['contact']['label'], $_SERVER["PHP_SELF"], "contact", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], "type", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "statut", "", $param, "", $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre($arrayfields['link']['label'], $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
print "</tr>";
|
||||
|
||||
foreach($list as $entry)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td class="nowrap">'.$entry->nature.'</td>';
|
||||
print '<td class="tdoverflowmax200">'.$entry->thirdparty.'</td>';
|
||||
print '<td class="tdoverflowmax200">'.$entry->contact.'</td>';
|
||||
print '<td class="tdoverflowmax200">'.$entry->type.'</td>';
|
||||
print '<td class="tdoverflowmax200 center">'.$entry->status.'</td>';
|
||||
|
||||
if ($permission)
|
||||
{
|
||||
$href = $_SERVER["PHP_SELF"];
|
||||
$href .= "?id=".$object->id;
|
||||
$href .= "&action=deletecontact";
|
||||
$href .= "&lineid=".$entry->id;
|
||||
|
||||
print "<td class='center'>";
|
||||
print "<a href='$href'>";
|
||||
print img_picto($langs->trans("Unlink"), "unlink");
|
||||
print "</a>";
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
print "</form>";
|
||||
print "</div>";
|
||||
|
||||
print "<!-- TEMPLATE CONTACTS HOOK BEGIN HERE -->\n";
|
||||
if (is_object($hookmanager)) {
|
||||
$hookmanager->initHooks(array('contacttpl'));
|
||||
@ -248,3 +318,4 @@ if (is_object($hookmanager)) {
|
||||
$reshook=$hookmanager->executeHooks('formContactTpl', $parameters, $object, $action);
|
||||
}
|
||||
print "<!-- END PHP TEMPLATE CONTACTS -->\n";
|
||||
|
||||
|
||||
@ -37,11 +37,14 @@ if (empty($conf) || !is_object($conf))
|
||||
<?php
|
||||
|
||||
// Other attributes
|
||||
$parameters = array();
|
||||
if (! isset($parameters)) $parameters = array();
|
||||
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
$params = isset($tpl_context) ? array('tpl_context' => $tpl_context) : array(); // BUG #11554 : Add tpl_context in params
|
||||
$params = array();
|
||||
if (isset($tpl_context)) $params['tpl_context'] = $tpl_context;
|
||||
$params['cols']=$parameters['colspanvalue'];
|
||||
print $object->showOptionals($extrafields, 'edit', $params); // BUG #11554 : Add context in params
|
||||
}
|
||||
|
||||
|
||||
@ -37,11 +37,13 @@ if (empty($conf) || ! is_object($conf))
|
||||
<?php
|
||||
|
||||
// Other attributes
|
||||
$parameters = array();
|
||||
if (! isset($parameters)) $parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
$params=array();
|
||||
$params['cols']=$parameters['colspanvalue'];
|
||||
print $object->showOptionals($extrafields, 'edit', $params);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -261,7 +261,7 @@ if ($nolinesbefore) {
|
||||
if ($senderissupplier != 2)
|
||||
{
|
||||
$ajaxoptions = array(
|
||||
'update' => array('qty'=>'qty', 'remise_percent' => 'discount', 'idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key
|
||||
'update' => array('qty'=>'qty', 'remise_percent' => 'discount', 'idprod' => 'idprod'), // html id tags that will be edited with each ajax json response key
|
||||
'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done
|
||||
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for example shown we select a disabled option into combo)
|
||||
);
|
||||
@ -636,11 +636,15 @@ if (!empty($usemargins) && $user->rights->margins->creer)
|
||||
{
|
||||
console.log("We are in a price per qty context, we do not call ajax/product");
|
||||
} else {
|
||||
<?php if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { ?>
|
||||
if (isNaN(pbq)) { console.log("We use experimental option PRODUIT_CUSTOMER_PRICES_BY_QTY or PRODUIT_CUSTOMER_PRICES_BY_QTY but we are not yet able to get the id of pbq from product combo list, so load of price may be 0 if product has differet prices"); }
|
||||
<?php } ?>
|
||||
// Get the HT price for the product and display it
|
||||
console.log("Load price without tax and set it into #price_ht for id="+$(this).val()+" socid=<?php print $object->socid; ?>");
|
||||
console.log("Load unit price without tax and set it into #price_ht for product id="+$(this).val()+" socid=<?php print $object->socid; ?>");
|
||||
$.post('<?php echo DOL_URL_ROOT; ?>/product/ajax/products.php?action=fetch',
|
||||
{ 'id': $(this).val(), 'socid': <?php print $object->socid; ?> },
|
||||
function(data) {
|
||||
console.log("Load unit price end, we got value "+data.price_ht);
|
||||
jQuery("#price_ht").val(data.price_ht);
|
||||
},
|
||||
'json'
|
||||
@ -658,95 +662,96 @@ if (!empty($usemargins) && $user->rights->margins->creer)
|
||||
$("#fournprice_predef").find("option").remove();
|
||||
$("#fournprice_predef").hide();
|
||||
$("#buying_price").val("").show();
|
||||
|
||||
/* Call post to load content of combo list fournprice_predef */
|
||||
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val() }, function(data) {
|
||||
if (data && data.length > 0)
|
||||
{
|
||||
var options = ''; var defaultkey = ''; var defaultprice = ''; var bestpricefound = 0;
|
||||
|
||||
var bestpriceid = 0; var bestpricevalue = 0;
|
||||
var pmppriceid = 0; var pmppricevalue = 0;
|
||||
var costpriceid = 0; var costpricevalue = 0;
|
||||
|
||||
/* setup of margin calculation */
|
||||
var defaultbuyprice = '<?php
|
||||
if (isset($conf->global->MARGIN_TYPE))
|
||||
{
|
||||
if ($conf->global->MARGIN_TYPE == '1') print 'bestsupplierprice';
|
||||
if ($conf->global->MARGIN_TYPE == 'pmp') print 'pmp';
|
||||
if ($conf->global->MARGIN_TYPE == 'costprice') print 'costprice';
|
||||
} ?>';
|
||||
console.log("we will set the field for margin. defaultbuyprice="+defaultbuyprice);
|
||||
|
||||
var i = 0;
|
||||
$(data).each(function() {
|
||||
/* Warning: Lines must be processed in order: best supplier price, then pmpprice line then costprice */
|
||||
if (this.id != 'pmpprice' && this.id != 'costprice')
|
||||
if (data && data.length > 0)
|
||||
{
|
||||
i++;
|
||||
this.price = parseFloat(this.price); // to fix when this.price >0
|
||||
// If margin is calculated on best supplier price, we set it by defaut (but only if value is not 0)
|
||||
//console.log("id="+this.id+"-price="+this.price+"-"+(this.price > 0));
|
||||
if (bestpricefound == 0 && this.price > 0) { defaultkey = this.id; defaultprice = this.price; bestpriceid = this.id; bestpricevalue = this.price; bestpricefound=1; } // bestpricefound is used to take the first price > 0
|
||||
}
|
||||
if (this.id == 'pmpprice')
|
||||
{
|
||||
// If margin is calculated on PMP, we set it by defaut (but only if value is not 0)
|
||||
console.log("id="+this.id+"-price="+this.price);
|
||||
if ('pmp' == defaultbuyprice || 'costprice' == defaultbuyprice)
|
||||
var options = ''; var defaultkey = ''; var defaultprice = ''; var bestpricefound = 0;
|
||||
|
||||
var bestpriceid = 0; var bestpricevalue = 0;
|
||||
var pmppriceid = 0; var pmppricevalue = 0;
|
||||
var costpriceid = 0; var costpricevalue = 0;
|
||||
|
||||
/* setup of margin calculation */
|
||||
var defaultbuyprice = '<?php
|
||||
if (isset($conf->global->MARGIN_TYPE))
|
||||
{
|
||||
if (this.price > 0) {
|
||||
defaultkey = this.id; defaultprice = this.price; pmppriceid = this.id; pmppricevalue = this.price;
|
||||
//console.log("pmppricevalue="+pmppricevalue);
|
||||
if ($conf->global->MARGIN_TYPE == '1') print 'bestsupplierprice';
|
||||
if ($conf->global->MARGIN_TYPE == 'pmp') print 'pmp';
|
||||
if ($conf->global->MARGIN_TYPE == 'costprice') print 'costprice';
|
||||
} ?>';
|
||||
console.log("we will set the field for margin. defaultbuyprice="+defaultbuyprice);
|
||||
|
||||
var i = 0;
|
||||
$(data).each(function() {
|
||||
/* Warning: Lines must be processed in order: best supplier price, then pmpprice line then costprice */
|
||||
if (this.id != 'pmpprice' && this.id != 'costprice')
|
||||
{
|
||||
i++;
|
||||
this.price = parseFloat(this.price); // to fix when this.price >0
|
||||
// If margin is calculated on best supplier price, we set it by defaut (but only if value is not 0)
|
||||
//console.log("id="+this.id+"-price="+this.price+"-"+(this.price > 0));
|
||||
if (bestpricefound == 0 && this.price > 0) { defaultkey = this.id; defaultprice = this.price; bestpriceid = this.id; bestpricevalue = this.price; bestpricefound=1; } // bestpricefound is used to take the first price > 0
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.id == 'costprice')
|
||||
{
|
||||
// If margin is calculated on Cost price, we set it by defaut (but only if value is not 0)
|
||||
console.log("id="+this.id+"-price="+this.price+"-pmppricevalue="+pmppricevalue);
|
||||
if ('costprice' == defaultbuyprice)
|
||||
if (this.id == 'pmpprice')
|
||||
{
|
||||
// If margin is calculated on PMP, we set it by defaut (but only if value is not 0)
|
||||
console.log("id="+this.id+"-price="+this.price);
|
||||
if ('pmp' == defaultbuyprice || 'costprice' == defaultbuyprice)
|
||||
{
|
||||
if (this.price > 0) {
|
||||
defaultkey = this.id; defaultprice = this.price; pmppriceid = this.id; pmppricevalue = this.price;
|
||||
//console.log("pmppricevalue="+pmppricevalue);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.id == 'costprice')
|
||||
{
|
||||
// If margin is calculated on Cost price, we set it by defaut (but only if value is not 0)
|
||||
console.log("id="+this.id+"-price="+this.price+"-pmppricevalue="+pmppricevalue);
|
||||
if ('costprice' == defaultbuyprice)
|
||||
{
|
||||
if (this.price > 0) { defaultkey = this.id; defaultprice = this.price; costpriceid = this.id; costpricevalue = this.price; }
|
||||
else if (pmppricevalue > 0) { defaultkey = 'pmpprice'; defaultprice = pmppricevalue; }
|
||||
}
|
||||
}
|
||||
options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>';
|
||||
});
|
||||
options += '<option value="inputprice" price="'+defaultprice+'"><?php echo $langs->trans("InputPrice"); ?></option>';
|
||||
|
||||
console.log("finally selected defaultkey="+defaultkey+" defaultprice for buying price="+defaultprice);
|
||||
|
||||
$("#fournprice_predef").html(options).show();
|
||||
if (defaultkey != '')
|
||||
{
|
||||
if (this.price > 0) { defaultkey = this.id; defaultprice = this.price; costpriceid = this.id; costpricevalue = this.price; }
|
||||
else if (pmppricevalue > 0) { defaultkey = 'pmpprice'; defaultprice = pmppricevalue; }
|
||||
$("#fournprice_predef").val(defaultkey);
|
||||
}
|
||||
|
||||
/* At loading, no product are yet selected, so we hide field of buying_price */
|
||||
$("#buying_price").hide();
|
||||
|
||||
/* Define default price at loading */
|
||||
var defaultprice = $("#fournprice_predef").find('option:selected').attr("price");
|
||||
$("#buying_price").val(defaultprice);
|
||||
|
||||
$("#fournprice_predef").change(function() {
|
||||
console.log("change on fournprice_predef");
|
||||
/* Hide field buying_price according to choice into list (if 'inputprice' or not) */
|
||||
var linevalue=$(this).find('option:selected').val();
|
||||
var pricevalue = $(this).find('option:selected').attr("price");
|
||||
if (linevalue != 'inputprice' && linevalue != 'pmpprice') {
|
||||
$("#buying_price").val(pricevalue).hide(); /* We set value then hide field */
|
||||
}
|
||||
if (linevalue == 'inputprice') {
|
||||
$('#buying_price').show();
|
||||
}
|
||||
if (linevalue == 'pmpprice') {
|
||||
$("#buying_price").val(pricevalue);
|
||||
$('#buying_price').hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>';
|
||||
});
|
||||
options += '<option value="inputprice" price="'+defaultprice+'"><?php echo $langs->trans("InputPrice"); ?></option>';
|
||||
|
||||
console.log("finally selected defaultkey="+defaultkey+" defaultprice="+defaultprice);
|
||||
|
||||
$("#fournprice_predef").html(options).show();
|
||||
if (defaultkey != '')
|
||||
{
|
||||
$("#fournprice_predef").val(defaultkey);
|
||||
}
|
||||
|
||||
/* At loading, no product are yet selected, so we hide field of buying_price */
|
||||
$("#buying_price").hide();
|
||||
|
||||
/* Define default price at loading */
|
||||
var defaultprice = $("#fournprice_predef").find('option:selected').attr("price");
|
||||
$("#buying_price").val(defaultprice);
|
||||
|
||||
$("#fournprice_predef").change(function() {
|
||||
console.log("change on fournprice_predef");
|
||||
/* Hide field buying_price according to choice into list (if 'inputprice' or not) */
|
||||
var linevalue=$(this).find('option:selected').val();
|
||||
var pricevalue = $(this).find('option:selected').attr("price");
|
||||
if (linevalue != 'inputprice' && linevalue != 'pmpprice') {
|
||||
$("#buying_price").val(pricevalue).hide(); /* We set value then hide field */
|
||||
}
|
||||
if (linevalue == 'inputprice') {
|
||||
$('#buying_price').show();
|
||||
}
|
||||
if (linevalue == 'pmpprice') {
|
||||
$("#buying_price").val(pricevalue);
|
||||
$('#buying_price').hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'json');
|
||||
|
||||
|
||||
@ -206,9 +206,10 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
else
|
||||
{
|
||||
$error ="Failed to insert security event: ".$event->error;
|
||||
$this->errors[] = $error;
|
||||
$this->error=$error;
|
||||
|
||||
dol_syslog(get_class($this).": ".$this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this).": ".$error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -829,7 +829,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->sendtoid=0;
|
||||
}
|
||||
// TODO Merge all previous cases into this generic one
|
||||
else // $action = TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, ...
|
||||
else // $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, ...
|
||||
{
|
||||
// Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function). Key can be set in agenda setup if defined into c_action_trigger
|
||||
// Load translation files required by the page
|
||||
|
||||
@ -137,10 +137,10 @@ if ($conf->use_javascript_ajax)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setWidth('100%');
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphstatus');
|
||||
print $dolgraph->show($total ? 0 : 1);
|
||||
|
||||
@ -159,7 +159,7 @@ $totalnb = 0;
|
||||
foreach ($listofstatus as $status)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td><a href="list.php?statut='.$status.'">'.$donstatic->LibStatut($status, 4).'</a></td>';
|
||||
print '<td><a href="list.php?search_status='.$status.'">'.$donstatic->LibStatut($status, 4).'</a></td>';
|
||||
print '<td class="right">'.(!empty($nb[$status]) ? $nb[$status] : ' ').'</td>';
|
||||
print '<td class="right">'.(!empty($nb[$status]) ?price($somme[$status], 'MT') : ' ').'</td>';
|
||||
print '<td class="right">'.(!empty($nb[$status]) ?price(price2num($somme[$status] / $nb[$status], 'MT')) : ' ').'</td>';
|
||||
|
||||
@ -43,7 +43,7 @@ $pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="d.datedon";
|
||||
|
||||
$search_status=(GETPOST("search_status", 'intcomma') != '') ? GETPOST("search_status", 'intcomma') : "-1";
|
||||
$search_status=(GETPOST("search_status", 'intcomma') != '') ? GETPOST("search_status", 'intcomma') : "-4";
|
||||
$search_all=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
|
||||
$search_ref=GETPOST('search_ref', 'alpha');
|
||||
$search_company=GETPOST('search_company', 'alpha');
|
||||
@ -60,6 +60,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_company = "";
|
||||
$search_name = "";
|
||||
$search_amount = "";
|
||||
$search_status = '';
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
@ -91,7 +92,7 @@ $sql.= " d.amount, d.fk_statut as status,";
|
||||
$sql.= " p.rowid as pid, p.ref, p.title, p.public";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
|
||||
$sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")";
|
||||
if ($search_status != '' && $search_status != '-1')
|
||||
if ($search_status != '' && $search_status != '-4')
|
||||
{
|
||||
$sql .= " AND d.fk_statut IN (".$db->escape($search_status).")";
|
||||
}
|
||||
@ -196,7 +197,15 @@ if ($resql)
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="liste_titre right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
|
||||
print '<td class="liste_titre right"></td>';
|
||||
print '<td class="liste_titre right">';
|
||||
$liststatus = array(
|
||||
Don::STATUS_DRAFT=>$langs->trans("DonationStatusPromiseNotValidated"),
|
||||
Don::STATUS_VALIDATED=>$langs->trans("DonationStatusPromiseValidated"),
|
||||
Don::STATUS_PAID=>$langs->trans("DonationStatusPaid"),
|
||||
Don::STATUS_CANCELED=>$langs->trans("Canceled")
|
||||
);
|
||||
print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
|
||||
print '</td>';
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
|
||||
@ -1236,13 +1236,14 @@ class EmailCollector extends CommonObject
|
||||
// References: <1542377954.SMTPs-dolibarr-tic649@8f6014fde11ec6cdec9a822234fc557e>
|
||||
// References: <1542377954.SMTPs-dolibarr-abc649@8f6014fde11ec6cdec9a822234fc557e>
|
||||
$trackid = '';
|
||||
$objectid = 0;
|
||||
$objectemail = null;
|
||||
|
||||
$reg = array();
|
||||
if (!empty($headers['References']) && preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $headers['References'], $reg))
|
||||
{
|
||||
$trackid = $reg[1].$reg[2];
|
||||
|
||||
$objectid = 0;
|
||||
$objectemail = null;
|
||||
if ($reg[1] == 'inv')
|
||||
{
|
||||
$objectid = $reg[2];
|
||||
@ -1814,8 +1815,8 @@ class EmailCollector extends CommonObject
|
||||
|
||||
|
||||
'thirdpartyid' => $thirdpartyid ,
|
||||
'objectid'=>@$objectid,
|
||||
'objectemail'=>@$objectemail,
|
||||
'objectid'=> $objectid,
|
||||
'objectemail'=> $objectemail,
|
||||
|
||||
'messagetext'=>$messagetext,
|
||||
'subject'=>$subject,
|
||||
|
||||
@ -1967,7 +1967,7 @@ elseif ($id || $ref)
|
||||
|
||||
// Tracking Number
|
||||
print '<tr><td class="titlefield">'.$form->editfieldkey("TrackingNumber", 'tracking_number', $object->tracking_number, $object, $user->rights->expedition->creer).'</td><td colspan="3">';
|
||||
print $form->editfieldval("TrackingNumber", 'tracking_number', $object->tracking_url, $object, $user->rights->expedition->creer, 'string', $object->tracking_number);
|
||||
print $form->editfieldval("TrackingNumber", 'tracking_number', $object->tracking_url, $object, $user->rights->expedition->creer, 'safehtmlstring', $object->tracking_number);
|
||||
print '</td></tr>';
|
||||
|
||||
// Incoterms
|
||||
|
||||
@ -85,6 +85,7 @@ class Expedition extends CommonObject
|
||||
|
||||
/**
|
||||
* @var string internal ref
|
||||
* @deprecated
|
||||
*/
|
||||
public $ref_int;
|
||||
|
||||
@ -523,15 +524,15 @@ class Expedition extends CommonObject
|
||||
* @param int $id Id of object to load
|
||||
* @param string $ref Ref of object
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param string $ref_int Internal reference of other object
|
||||
* @param string $notused Internal reference of other object
|
||||
* @return int >0 if OK, 0 if not found, <0 if KO
|
||||
*/
|
||||
public function fetch($id, $ref = '', $ref_ext = '', $ref_int = '')
|
||||
public function fetch($id, $ref = '', $ref_ext = '', $notused = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Check parameters
|
||||
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
|
||||
if (empty($id) && empty($ref) && empty($ref_ext)) return -1;
|
||||
|
||||
$sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.fk_projet as fk_project, e.billed";
|
||||
$sql.= ", e.date_valid";
|
||||
@ -551,7 +552,7 @@ class Expedition extends CommonObject
|
||||
if ($id) $sql.= " AND e.rowid=".$id;
|
||||
if ($ref) $sql.= " AND e.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql.= " AND e.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql.= " AND e.ref_int='".$this->db->escape($ref_int)."'";
|
||||
if ($notused) $sql.= " AND e.ref_int='".$this->db->escape($notused)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
@ -697,7 +698,7 @@ class Expedition extends CommonObject
|
||||
{
|
||||
$numref = "EXP".$this->id;
|
||||
}
|
||||
$this->newref = $numref;
|
||||
$this->newref = dol_sanitizeFileName($numref);
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
|
||||
@ -1015,7 +1015,9 @@ class ExpenseReport extends CommonObject
|
||||
public function fetch_lines()
|
||||
{
|
||||
// phpcs:enable
|
||||
$this->lines = array();
|
||||
global $conf;
|
||||
|
||||
$this->lines = array();
|
||||
|
||||
$sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,';
|
||||
$sql .= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet as fk_project, de.tva_tx, de.fk_ecm_files,';
|
||||
@ -1163,7 +1165,7 @@ class ExpenseReport extends CommonObject
|
||||
}
|
||||
if (empty($num) || $num < 0) return -1;
|
||||
|
||||
$this->newref = $num;
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
@ -136,10 +136,10 @@ if ($conf->use_javascript_ajax)
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setHeight(350);
|
||||
$dolgraph->combine = empty($conf->global->MAIN_EXPENSEREPORT_COMBINE_GRAPH_STAT) ? 0.05 : $conf->global->MAIN_EXPENSEREPORT_COMBINE_GRAPH_STAT;
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setWidth('100%');
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphstatus');
|
||||
print $dolgraph->show($totalnb ? 0 : 1);
|
||||
|
||||
|
||||
@ -248,14 +248,14 @@ if ($action == 'create' || empty($action))
|
||||
print '<table class="border centpercent">'."\n";
|
||||
|
||||
print '<tr><td class="titlefield fieldrequired">'.$langs->trans("Date").'</td><td colspan="2">';
|
||||
$datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||
$datepaid = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST("reday", 'int'), GETPOST("reyear", 'int'));
|
||||
$datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaid):0;
|
||||
print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1);
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td colspan="2">';
|
||||
$form->select_types_paiements(isset($_POST["fk_typepayment"])?$_POST["fk_typepayment"]:$expensereport->fk_typepayment, "fk_typepayment");
|
||||
$form->select_types_paiements(GETPOSTISSET("fk_typepayment") ? GETPOST("fk_typepayment", 'alpha') : $expensereport->fk_c_paiement, "fk_typepayment");
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
@ -264,7 +264,7 @@ if ($action == 'create' || empty($action))
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
|
||||
print '<td colspan="2">';
|
||||
$form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$expensereport->accountid, "accountid", 0, '', 1); // Show open bank account list
|
||||
$form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid", "int") : $expensereport->accountid, "accountid", 0, '', 1); // Show open bank account list
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -1064,9 +1064,11 @@ if ($action == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
if (is_object($objectsrc))
|
||||
{
|
||||
print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">';
|
||||
|
||||
@ -36,6 +36,35 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
|
||||
*/
|
||||
class Fichinter extends CommonObject
|
||||
{
|
||||
|
||||
public $fields=array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
|
||||
'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
|
||||
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>45),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
|
||||
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'datei' =>array('type'=>'date', 'label'=>'Datei', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>70),
|
||||
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
||||
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
|
||||
'dateo' =>array('type'=>'date', 'label'=>'Dateo', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||
'datee' =>array('type'=>'date', 'label'=>'Datee', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'datet' =>array('type'=>'date', 'label'=>'Datet', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
'duree' =>array('type'=>'double', 'label'=>'Duree', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>105,'showoncombobox'=>1),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>115),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>120),
|
||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>130),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>135),
|
||||
);
|
||||
/**
|
||||
* @var string ID to identify managed object
|
||||
*/
|
||||
@ -544,7 +573,7 @@ class Fichinter extends CommonObject
|
||||
{
|
||||
$num = $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
|
||||
$sql .= " SET fk_statut = 1";
|
||||
|
||||
@ -243,10 +243,9 @@ class FichinterRec extends Fichinter
|
||||
* @param int $rowid Id of object to load
|
||||
* @param string $ref Reference of fichinter
|
||||
* @param string $ref_ext External reference of fichinter
|
||||
* @param int $ref_int Internal reference of other object
|
||||
* @return int >0 if OK, <0 if KO, 0 if not found
|
||||
*/
|
||||
public function fetch($rowid = 0, $ref = '', $ref_ext = '', $ref_int = '')
|
||||
public function fetch($rowid = 0, $ref = '', $ref_ext = '')
|
||||
{
|
||||
$sql = 'SELECT f.titre, f.fk_soc';
|
||||
$sql .= ', f.datec, f.duree, f.fk_projet, f.fk_contrat, f.description';
|
||||
@ -258,11 +257,6 @@ class FichinterRec extends Fichinter
|
||||
if ($rowid > 0) $sql .= ' WHERE f.rowid='.$rowid;
|
||||
elseif ($ref) $sql .= " WHERE f.titre='".$this->db->escape($ref)."'";
|
||||
|
||||
/* This field are not used for template fichinter
|
||||
if ($ref_ext) $sql.= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql.= " AND f.ref_int='".$this->db->escape($ref_int)."'";
|
||||
*/
|
||||
|
||||
dol_syslog(get_class($this)."::fetch rowid=".$rowid, LOG_DEBUG);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user