Merge branch 'Dolibarr:develop' into develop

This commit is contained in:
Giovanni Vella 2021-11-23 08:48:52 +01:00 committed by GitHub
commit f7abf59a07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3464 changed files with 109152 additions and 50440 deletions

117
ChangeLog
View File

@ -143,6 +143,123 @@ Following changes may create regressions for some external modules, but were nec
***** ChangeLog for 14.0.4 compared to 14.0.3 *****
FIX: $totalarray is overwritten, totals were lost
FIX: 13.0 - due to a typo in the 'mode' parameter, the "first name" column of the list of members displays the full name
FIX: 13.0: end date required to edit a ticket message
FIX: 13.0 feedback of PR #18993: make ticket messages punctual events with attr percentage = -1
FIX: 13.0 PR #18993: add comment on modified part
FIX: 13.0: sometimes firstname was mistyped as fistname
FIX: 14.0 - civility field of private third party creation form has inadequate width
FIX: 14.0 - civility field width inadequate due to select2 calculating the width while the field has no width (display: none)
FIX: 14.0 - due to a typo in the 'mode' parameter, the "first name" co…
FIX: #18634 : Problem of virtual stock with reception module enabled
FIX: #18695 Added ref_ext to supplier invoice
FIX: #18698 Supplier invoice list - "alert" checkbox not working
FIX: #18735
FIX: #18767 : Adherent delete
FIX: #18797
FIX: #18854
FIX: #18875 in v14
FIX: #18910
FIX: #18910 : MRP List SQL query syntax error with more than one extrafileds.
FIX: #18912 Accountancy - SQL error when custom group is added without country defined
FIX: #18934 on-registration in the extrafieldsline database for deliveries
FIX: #18968
FIX: #19008
FIX: #19014 - the properties of some fields are not updated when you submit the form
FIX: #19210
FIX: #19214 : PostgreSQL error on admin/limits.php
FIX: #19241 Project - Fix display salary in overview
FIX: #19305
FIX: 2 columns for total labels
FIX: Accountancy - Format Quadra export - Missing line type C to create automaticly a subledger account with label
FIX: Accountancy - If deposit invoice is used, force binding in deposit accounting account to solve transaction
FIX: Accountancy - Missing specific filename for export on format FEC2, Ciel & repare it
FIX: Accountancy - Option of export popup are inverted
FIX: Accountancy - PHP8
FIX: Accountancy - Product admin - SQL error when we affect accounting account with product_perentity activated
FIX: Accountancy simplified - Salaries are not present in report
FIX: Accountancy - Some correction on export name
FIX: Accountancy - Trunc code_journal to 2 in format XIMPORT (Ciel, Sage50)
FIX: add warehouse in projects' overview count
FIX: also on customer index for automatic binding
FIX: Attachment of pdf into shipment when sending email
FIX: autocalculation of the supplier price in main currency.
FIX: avoid warning if $categories is an id
FIX: bad sign of amount stored for multicurrency columns on credit notes
FIX: Bad use of a forced contact of another company on PDF/ODT documents
FIX: Bad use of dol_concatdesc()
FIX: Button text on proposal card for create a invoice
FIX: calculateCosts of BOM must not be included into fetch
FIX: calculation of balance in conciliation page on desc sorting.
FIX: card.php
FIX: Change date format of the inventorycode to be equal as mass stock transfert
FIX: check if greater 0
FIX: close cash with some terminals in TakePOS
FIX: compatibility with Multicompany
FIX: consistent UX when calling a tab from the invoice card with empty ref/id
FIX: default language defined for IN country
FIX: Expense report - In edit mode, field qty doesn't accept decimal unlike the create mode
FIX: fetch of product with modulebuilder load too much data
FIX: filter for export of accounting documents
FIX: Filter on categories
FIX: generate documents with PDF options
FIX: indentation
FIX: init hookmanager after loading $conf values
FIX: invoice: inpossible to create an invoice because of very bad check + warnings when trying to print tabs for invoice with no ID
FIX: legal issue on expense report pdf (must also show price without tax)
FIX: list of categories in stats of supplier invoices
FIX: load tranlate array after setting lang
FIX: lost superadmin grade after edit user card
FIX: missing filter status=1 on rss feeds
FIX: missing permission check reported by me@lainwir3d.net on product api
FIX: missing return status
FIX: missing sql filter by entity
FIX: move fetch_optionnal into $ac_static->fetch()
FIX: only a superadmin can modify entity
FIX: only ones value is return for dictionaries
FIX: optional visibility on create card
FIX: payment style and html5 tags
FIX: payment using wrong type in takepos when too many payment mode
FIX: PR#18931 Remove useless explicit call to dol_shutdown
FIX: Product accountancy affectation with product_perentity activated (PR #18620)
FIX: products/services card: hidden extrafields were overridden
FIX: project task list: extrafields could not be displayed
FIX: Propal list - Problem of pagination on date
FIX: reload user lang
FIX: Remove not complete order from the virtual stock
FIX: Replenish: SQL error when no warehouse has been created + Warning when there are no warehouses
FIX: resource list : Use standard code to handle list filters
FIX: restrictedArea for payment delete
FIX: Ret PR
FIX: second approval back in stable feature as is the setting for minimum amount (last part from PR#14286)
FIX: selected lines on supplier invoice create
FIX: Selection of type "people" for membership must hide the company
FIX: select list of orders not complete when field type of company is on
FIX: show end hours in events linked to objects
FIX: support of localtax on expense report
FIX: task time: can't filter by user with pgsql + show error message
FIX: task time: keep on using natural_search
FIX: tcpdf vulnerability to roman numeral bomb, cf. tecnickom/TCPDF issue #315
FIX: Test when date of invoie is in future (pb with TZ and offset)
FIX: Ticket - Card - Wrong font awesome library
FIX: Ticket - Duplicate field project when we create ticket from project
FIX: translation into email for member at membership validation.
FIX: Travis Sanitize SQL
FIX: unprivileged user can see task associated with a not allowed project
FIX: URGENT: impossible to create an invoice
FIX: Use of accent into filename of GED
FIX: user date timezone offset
FIX: User salary card - translation problem
FIX: user without permission can set ticket subject
FIX: We need a default price base type in variant creation case with multiprices when parent has been created with only one level price
FIX: wrong array key value
FIX: wrong check
FIX: wrong position of error message
Sync transifex.
***** ChangeLog for 14.0.3 compared to 14.0.2 *****
FIX: #18698 Supplier invoice list - "alert" checkbox not working

View File

@ -12,8 +12,7 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
## Reporting a Vulnerability
To report a vulnerability, please use GitHub security advisory at https://github.com/Dolibarr/dolibarr/security/advisories/new (if you have permissions) or alternatively send an email to security@dolibarr.org (for everybody)
To report a vulnerability, please use GitHub security advisory at [https://github.com/Dolibarr/dolibarr/security/advisories/new](https://github.com/Dolibarr/dolibarr/security/advisories/new) (if you have permissions) or alternatively send an email to security@dolibarr.org (for everybody)
## Hunting vulnerabilities on Dolibarr
@ -23,7 +22,7 @@ If you believe you've found a security bug in our service, we are happy to work
Any type of denial of service attacks is strictly forbidden, as well as any interference with network equipment and Dolibarr infrastructure.
We recommand to install Dolibarr ERP CRM on your own server (as most Open Source software, download and use is free: https://www.dolibarr.org/download) to get access on every side of application.
We recommand to install Dolibarr ERP CRM on your own server (as most Open Source software, download and use is free: [https://www.dolibarr.org/download](https://www.dolibarr.org/download)) to get access on every side of application.
### User Agent
@ -31,8 +30,7 @@ If you try to find bug on Dolibarr, we recommend to append to your user-agent he
### Account access
You can install the web application yourself on your own platform/server so you get full access to application and sources. Download the zip of the files to put into your own web server virtual host from https://www.dolibarr.org/download
You can install the web application yourself on your own platform/server so you get full access to application and sources. Download the zip of the files to put into your own web server virtual host from [https://www.dolibarr.org/download](https://www.dolibarr.org/download)
## Eligibility and Responsible Disclosure
@ -46,7 +44,6 @@ You must avoid tests that could cause degradation or interruption of our service
You must not leak, manipulate, or destroy any user data of third parties to find your vulnerability.
## Scope for qualified vulnerabilities
ONLY vulnerabilities discovered, when the following setup on test platform is used, are "valid":
@ -64,7 +61,6 @@ ONLY vulnerabilities discovered, when the following setup on test platform is us
Scope is the web application (back office) and the APIs.
## Qualifying vulnerabilities for reporting
* Remote code execution (RCE)
@ -81,7 +77,6 @@ Scope is the web application (back office) and the APIs.
* Software version disclosure (for non admin users only)
* Stack traces or path disclosure (for non admin users only)
## Non-qualifying vulnerabilities for reporting
* "Self" XSS
@ -99,4 +94,3 @@ Scope is the web application (back office) and the APIs.
* Software version or private IP disclosure when logged user is admin
* Stack traces or path disclosure when logged user is admin
* Any vulnerabilities due to a configuration different than the one defined into chapter "Scope for qualified vulnerabilities".

View File

@ -4,7 +4,7 @@
*
* 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 2 of the License, or
* 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,

View File

@ -4,7 +4,7 @@
*
* 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 2 of the License, or
* 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,

View File

@ -6,7 +6,7 @@
*
* 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 2 of the License, or
* 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,

View File

@ -5,7 +5,7 @@
*
* 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 2 of the License, or
* 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,

View File

@ -495,7 +495,7 @@ if ($id) {
if ($valuetoshow != '') {
print '<td class="'.$class.'">';
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
print '<a href="'.$tabhelp[$id][$value].'">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (!empty($tabhelp[$id][$value])) {
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
} else {

View File

@ -520,7 +520,7 @@ if ($tabname[$id]) {
if ($valuetoshow != '') {
print '<td class="'.$class.'">';
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
print '<a href="'.$tabhelp[$id][$value].'">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (!empty($tabhelp[$id][$value])) {
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
} else {

View File

@ -52,6 +52,7 @@ $list_account_main = array(
);
$list_account = array();
$list_account[] = '---Product---';
$list_account[] = 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT';
if ($mysoc->isInEEC()) {
@ -63,6 +64,7 @@ if ($mysoc->isInEEC()) {
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT';
}
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT';
$list_account[] = '---Service---';
$list_account[] = 'ACCOUNTING_SERVICE_SOLD_ACCOUNT';
if ($mysoc->isInEEC()) {
@ -74,11 +76,11 @@ if ($mysoc->isInEEC()) {
$list_account[] = 'ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT';
}
$list_account[] = 'ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT';
$list_account[] = '---Others---';
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT';
$list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE';
if ($conf->banque->enabled) {
$list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
}
@ -96,6 +98,7 @@ if ($conf->loan->enabled) {
if ($conf->societe->enabled) {
$list_account[] = 'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT';
}
$list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE';
/*
* Actions
@ -154,6 +157,7 @@ print '<input type="hidden" name="action" value="update">';
// Define main accounts for thirdparty
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("ThirdParties").' | '.$langs->trans("Users").'</td><td></td></tr>';
@ -164,17 +168,29 @@ foreach ($list_account_main as $key) {
$keydesc = $key.'_Desc';
$htmltext = $langs->trans($keydesc);
print '<td class="fieldrequired" width="50%">';
print '<td class="fieldrequired">';
if ($key == 'ACCOUNTING_ACCOUNT_CUSTOMER') {
print img_picto('', 'company', 'class="pictofixedwidth"');
} elseif ($key == 'ACCOUNTING_ACCOUNT_SUPPLIER') {
print img_picto('', 'company', 'class="pictofixedwidth"');
} else {
print img_picto('', 'user', 'class="pictofixedwidth"');
}
print $form->textwithpicto($label, $htmltext);
print '</td>';
// Value
print '<td>'; // Do not force class=right, or it align also the content of the select box
print '<td class="right">'; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accountsmain');
print '</td>';
print '</tr>';
}
print "</table>\n";
print "</div>\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
foreach ($list_account as $key) {
$reg = array();
if (preg_match('/---(.*)---/', $key, $reg)) {
@ -183,9 +199,32 @@ foreach ($list_account as $key) {
print '<tr class="oddeven value">';
// Param
$label = $langs->trans($key);
print '<td width="50%">'.$label.'</td>';
print '<td>';
if (preg_match('/^ACCOUNTING_PRODUCT/', $key)) {
print img_picto('', 'product', 'class="pictofixedwidth"');
} elseif (preg_match('/^ACCOUNTING_SERVICE/', $key)) {
print img_picto('', 'service', 'class="pictofixedwidth"');
} elseif (preg_match('/^ACCOUNTING_VAT_PAY_ACCOUNT/', $key)) {
print img_picto('', 'payment_vat', 'class="pictofixedwidth"');
} elseif (preg_match('/^ACCOUNTING_VAT/', $key)) {
print img_picto('', 'vat', 'class="pictofixedwidth"');
} elseif (preg_match('/^ACCOUNTING_ACCOUNT_CUSTOMER/', $key)) {
print img_picto('', 'bill', 'class="pictofixedwidth"');
} elseif (preg_match('/^LOAN_ACCOUNTING_ACCOUNT/', $key)) {
print img_picto('', 'loan', 'class="pictofixedwidth"');
} elseif (preg_match('/^DONATION_ACCOUNTING/', $key)) {
print img_picto('', 'donation', 'class="pictofixedwidth"');
} elseif (preg_match('/^ADHERENT_SUBSCRIPTION/', $key)) {
print img_picto('', 'member', 'class="pictofixedwidth"');
} elseif (preg_match('/^ACCOUNTING_ACCOUNT_TRANSFER/', $key)) {
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
} elseif (preg_match('/^ACCOUNTING_ACCOUNT_SUSPENSE/', $key)) {
print img_picto('', 'question', 'class="pictofixedwidth"');
}
print $label;
print '</td>';
// Value
print '<td>'; // Do not force class=right, or it align also the content of the select box
print '<td class="right">'; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts');
print '</td>';
print '</tr>';
@ -194,7 +233,7 @@ foreach ($list_account as $key) {
print "</table>\n";
print "</div>\n";
print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>';

View File

@ -453,7 +453,7 @@ if ($id) {
if ($valuetoshow != '') {
print '<td class="'.$class.'">';
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
print '<a href="'.$tabhelp[$id][$value].'">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (!empty($tabhelp[$id][$value])) {
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
} else {

View File

@ -4,6 +4,7 @@
* 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>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -47,9 +48,12 @@ if (empty($user->rights->accounting->bind->write)) {
// search & action GETPOST
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$codeventil_buy = GETPOST('codeventil_buy', 'array');
$codeventil_sell = GETPOST('codeventil_sell', 'array');
$chk_prod = GETPOST('chk_prod', 'array');
$default_account = GETPOST('default_account', 'int');
$confirm = GETPOST('confirm', 'alpha');
$account_number_buy = GETPOST('account_number_buy');
$account_number_sell = GETPOST('account_number_sell');
$changeaccount = GETPOST('changeaccount', 'array');
@ -68,7 +72,6 @@ $search_onsell = GETPOST('search_onsell', 'alpha');
$search_onpurchase = GETPOST('search_onpurchase', 'alpha');
$accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
$btn_changeaccount = GETPOST('changeaccount', 'alpha');
$btn_changetype = GETPOST('changetype', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
@ -165,7 +168,7 @@ if ($action == 'update') {
}
}
if (!empty($btn_changeaccount)) {
if (!empty($chk_prod) && $massaction === 'changeaccount') {
//$msg = '<div><span class="accountingprocessing">' . $langs->trans("Processing") . '...</span></div>';
if (!empty($chk_prod) && in_array($accounting_product_mode, $accounting_product_modes)) {
$accounting = new AccountingAccount($db);
@ -436,11 +439,27 @@ if ($result) {
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massaction !== 'set_default_account') {
$arrayofmassactions = array(
'changeaccount'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Save")
,'set_default_account'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ConfirmPreselectAccount")
);
$massactionbutton = $form->selectMassAction('', $arrayofmassactions, 1);
}
$buttonsave = '<input type="submit" class="button button-save" id="changeaccount" name="changeaccount" value="'.$langs->trans("Save").'">';
//print '<br><div class="center">'.$buttonsave.'</div>';
$texte = $langs->trans("ListOfProductsServices");
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1);
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1);
if ($massaction == 'set_default_account') {
$formquestion[]=array('type' => 'other',
'name' => 'set_default_account',
'label' => $langs->trans("AccountancyCode"),
'value' => $form->select_account('', 'default_account', 1, array(), 0, 0, 'maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'));
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmPreselectAccount"), $langs->trans("ConfirmPreselectAccountQuestion", count($chk_prod)), "confirm_set_default_account", $formquestion, 1, 0, 200, 500, 1);
}
print '<div class="div-table-responsive">';
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
@ -645,7 +664,7 @@ 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, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print $form->select_account(($default_account > 0 && $confirm === 'yes' && in_array($product_static->id, $chk_prod)) ? $default_account : $defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
// Accounting account buy intra (In EEC)
@ -659,7 +678,7 @@ 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, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print $form->select_account(($default_account > 0 && $confirm === 'yes' && in_array($product_static->id, $chk_prod)) ? $default_account : $defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
// Accounting account buy export (Out of EEC)
@ -673,7 +692,7 @@ 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, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print $form->select_account(($default_account > 0 && $confirm === 'yes' && in_array($product_static->id, $chk_prod)) ? $default_account : $defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
// Accounting account sell
@ -687,7 +706,7 @@ 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, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print $form->select_account(($default_account > 0 && $confirm === 'yes' && in_array($product_static->id, $chk_prod)) ? $default_account : $defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
// Accounting account sell intra (In EEC)
@ -701,7 +720,7 @@ 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, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print $form->select_account(($default_account > 0 && $confirm === 'yes' && in_array($product_static->id, $chk_prod)) ? $default_account : $defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print '</td>';
} else {
// Accounting account sell export (Out of EEC)
@ -714,13 +733,20 @@ 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, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print $form->select_account(($default_account > 0 && $confirm === 'yes' && in_array($product_static->id, $chk_prod)) ? $default_account : $defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print '</td>';
}
if (!empty($chk_prod)) {
$ischecked = 0;
if (in_array($product_static->id, $chk_prod)) {
$ischecked=true;
}
}
// Checkbox select
print '<td class="center">';
print '<input type="checkbox" class="checkforselect productforselectcodeventil_'.$product_static->id.'" name="chk_prod[]" value="'.$obj->rowid.'"/></td>';
print '<input type="checkbox" class="checkforselect productforselectcodeventil_'.$product_static->id.'" name="chk_prod[]" '.($ischecked ? "checked" : "").' value="'.$obj->rowid.'"/></td>';
print "</tr>";
$i++;
}

View File

@ -732,17 +732,16 @@ class AccountingAccount extends CommonObject
/**
* Return Suggest accounting accounts to bind
*
* @param Societe $buyer Societe Object Buyers
* @param $seller Company Object seller
* @param Product $product Product object sell or buy
* @param Facture $facture Facture
* @param FactureLigne $factureDet Facture Det
* @param array $accountingAccount array of Account account
* @param string $type Customer / Supplier
*
* @return array Accounting accounts suggested
* @param Societe $buyer Object buyer
* @param Societe $seller Object seller
* @param Product $product Product object sell or buy
* @param Facture|FactureFournisseur $facture Facture
* @param FactureLigne|SupplierInvoiceLine $factureDet Facture Det
* @param array $accountingAccount Array of Account account
* @param string $type Customer / Supplier
* @return array Accounting accounts suggested
*/
public function getAccountingCodeToBind(Societe $buyer, $seller, Product $product, Facture $facture, FactureLigne $factureDet, $accountingAccount = array(), $type = '')
public function getAccountingCodeToBind(Societe $buyer, Societe $seller, Product $product, $facture, $factureDet, $accountingAccount = array(), $type = '')
{
global $conf;
global $hookmanager;
@ -755,21 +754,21 @@ class AccountingAccount extends CommonObject
$reshook = $hookmanager->executeHooks('accoutancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
if ($type=='customer') {
if ($type == 'customer') {
$const_name = "SOLD";
} elseif ($type=='supplier') {
} elseif ($type == 'supplier') {
$const_name = "BUY";
}
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
$isBuyerInEEC = isInEEC($buyer);
$isSellerInEEC = isInEEC($seller);
$code_l = '';
$code_p = '';
$code_t = '';
$code_l = ''; // Default value for generic product/service
$code_p = ''; // Value for the product/service in parameter ($product)
$code_t = ''; // Default value of product account for the thirdparty
$suggestedid = '';
// Level 1: Search suggested default account for product/service
// Level 1 (define $code_l): Search suggested default account for product/service
$suggestedaccountingaccountbydefaultfor = '';
if ($factureDet->product_type == 1) {
if ($buyer->country_code == $seller->country_code || empty($buyer->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
@ -814,14 +813,14 @@ class AccountingAccount extends CommonObject
$code_l = '';
}
// Level 2: Search suggested account for product/service (similar code exists in page index.php to make automatic binding)
// Level 2 (define $code_p): Search suggested account for product/service (similar code exists in page index.php to make automatic binding)
$suggestedaccountingaccountfor = '';
if ((($buyer->country_code == $seller->country_code) || empty($buyer->country_code))) {
// If buyer in same country than seller (if not defined, we assume it is same country)
if ($type=='customer' && !empty($product->accountancy_code_sell)) {
$code_p = $product->accountancy_code_sell;
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) {
$code_p = $product->accountancy_code_sell;
$code_p = $product->accountancy_code_buy;
}
$suggestedid = $accountingAccount['dom'];
$suggestedaccountingaccountfor = 'prodserv';
@ -831,7 +830,7 @@ class AccountingAccount extends CommonObject
if ($type=='customer' && !empty($product->accountancy_code_sell)) {
$code_p = $product->accountancy_code_sell;
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) {
$code_p = $product->accountancy_code_sell;
$code_p = $product->accountancy_code_buy;
}
$suggestedid = $accountingAccount['dom'];
$suggestedaccountingaccountfor = 'eecwithvat';
@ -840,7 +839,7 @@ class AccountingAccount extends CommonObject
if ($type=='customer' && !empty($product->accountancy_code_sell)) {
$code_p = $product->accountancy_code_sell;
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) {
$code_p = $product->accountancy_code_sell;
$code_p = $product->accountancy_code_buy;
}
$suggestedid = $accountingAccount['dom']; // There is a doubt for this case. Is it an error on vat or we just forgot to fill vat number ?
$suggestedaccountingaccountfor = 'eecwithoutvatnumber';
@ -855,18 +854,17 @@ class AccountingAccount extends CommonObject
$suggestedaccountingaccountfor = 'eec';
} else {
// Foreign sale
// European intravat sale
if ($type=='customer' && !empty($product->accountancy_code_sell_export)) {
$code_p = $product->accountancy_code_sell_export;
} elseif ($type=='supplier' && !empty($product->accountancy_code_sell_export)) {
$code_p = $product->accountancy_code_sell_export;
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy_export)) {
$code_p = $product->accountancy_code_buy_export;
}
$suggestedid = $accountingAccount['export'];
$suggestedaccountingaccountfor = 'export';
}
}
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
// Level 3 (define $code_t): Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
if (!empty($buyer->code_compta)) {
$code_t = $buyer->code_compta;
@ -876,7 +874,7 @@ class AccountingAccount extends CommonObject
}
// Manage Deposit
if ($factureDet->desc == "(DEPOSIT)") {
if ($factureDet->desc == "(DEPOSIT)" || $facture->type == $facture::TYPE_DEPOSIT) {
$accountdeposittoventilated = new self($this->db);
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
if ($result < 0) {
@ -888,6 +886,7 @@ class AccountingAccount extends CommonObject
$suggestedaccountingaccountfor = 'deposit';
}
// If $suggestedid could not be guessed yet, we set it from the generic default accounting code $code_l
if (empty($suggestedid) && empty($code_p) && !empty($code_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC)) {
if (empty($this->accountingaccount_codetotid_cache[$code_l])) {
$tmpaccount = new self($this->db);

View File

@ -6,7 +6,7 @@
*
* 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 2 of the License, or
* 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,

View File

@ -36,6 +36,9 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
// Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "other", "accountancy"));
$validatemonth = GETPOST('validatemonth', 'int');
$validateyear = GETPOST('validateyear', 'int');
// Security check
if (empty($conf->accounting->enabled)) {
accessforbidden();
@ -174,6 +177,9 @@ if ($action == 'validatehistory') {
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
}
if ($validatemonth && $validateyear) {
$sql .= dolSqlDateFilter('f.datef', 0, $validatemonth, $validateyear);
}
dol_syslog('htdocs/accountancy/customer/index.php');
@ -245,42 +251,23 @@ if ($action == 'validatehistory') {
$code_sell_p_notset = '';
$code_sell_t_notset = '';
$suggestedid = 0;
$return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'customer');
if (!is_array($return) && $return<0) {
setEventMessage($accountingAccount->error, 'errors');
} else {
$suggestedid=$return['suggestedid'];
$suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor'];
$suggestedid = $return['suggestedid'];
$suggestedaccountingaccountfor = $return['suggestedaccountingaccountfor'];
if (!empty($suggestedid) && $suggestedaccountingaccountfor<>'') {
$suggestedid=$return['suggestedid'];
if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
$suggestedid = $return['suggestedid'];
} else {
$suggestedid=0;
$suggestedid = 0;
}
}
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($objp->company_code_sell)) {
$objp->code_sell_t = $objp->company_code_sell;
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
$suggestedaccountingaccountfor = '';
}
}
// Manage Deposit
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT)) {
if ($objp->description == "(DEPOSIT)" || $objp->ftype == $facture_static::TYPE_DEPOSIT) {
$accountdeposittoventilated = new AccountingAccount($db);
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
$objp->code_sell_l = $accountdeposittoventilated->ref;
$objp->code_sell_p = '';
$objp->code_sell_t = '';
$objp->aarowid_suggest = $accountdeposittoventilated->rowid;
}
}
if ($objp->aarowid_suggest > 0) {
if ($suggestedid > 0) {
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facturedet";
$sqlupdate .= " SET fk_code_ventilation = ".((int) $suggestedid);
$sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".((int) $facture_static_det->id);
@ -325,7 +312,7 @@ print '</span><br>';
$y = $year_current;
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?year='.$year_current.'&action=validatehistory">'.$langs->trans("ValidateHistory").'</a>';
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.$langs->trans("ValidateHistory").'</a>';
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
@ -339,7 +326,24 @@ for ($i = 1; $i <= 12; $i++) {
if ($j > 12) {
$j -= 12;
}
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
$cursormonth = $j;
if ($cursormonth > 12) {
$cursormonth -= 12;
}
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
print '<td width="60" class="right">';
if (!empty($tmp['mday'])) {
$param = 'search_date_startday=1&search_date_startmonth='.$cursormonth.'&search_date_startyear='.$cursoryear;
$param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year'];
print '<a href="'.DOL_URL_ROOT.'/accountancy/customer/list.php?'.$param.'">';
}
print $langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT));
if (!empty($tmp['mday'])) {
print '</a>';
}
print '</td>';
}
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
@ -379,7 +383,8 @@ if ($resql) {
$num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>';
print '<tr class="oddeven">';
print '<td>';
if ($row[0] == 'tobind') {
print '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>';
} else {
@ -388,19 +393,33 @@ if ($resql) {
print '</td>';
print '<td>';
if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
} else {
print $row[1];
}
print '</td>';
for ($i = 2; $i <= 12; $i++) {
print '<td class="right nowraponall amount">'.price($row[$i]).'</td>';
for ($i = 2; $i <= 13; $i++) {
$cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2);
if ($cursormonth > 12) {
$cursormonth -= 12;
}
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
print '<td class="right nowraponall amount">';
print price($row[$i]);
print '</td>';
}
print '<td class="right nowraponall amount">'.price($row[13]).'</td>';
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
print '</tr>';
}
$db->free($resql);
if ($num == 0) {
print '<tr class="oddeven"><td colspan="16">';
print '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
print '</td></tr>';
}
} else {
print $db->lasterror(); // Show last sql error
}
@ -423,7 +442,24 @@ for ($i = 1; $i <= 12; $i++) {
if ($j > 12) {
$j -= 12;
}
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
$cursormonth = $j;
if ($cursormonth > 12) {
$cursormonth -= 12;
}
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
print '<td width="60" class="right">';
if (!empty($tmp['mday'])) {
$param = 'search_date_startday=1&search_date_startmonth='.$cursormonth.'&search_date_startyear='.$cursoryear;
$param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year'];
print '<a href="'.DOL_URL_ROOT.'/accountancy/customer/lines.php?'.$param.'">';
}
print $langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT));
if (!empty($tmp['mday'])) {
print '</a>';
}
print '</td>';
}
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
@ -463,7 +499,8 @@ if ($resql) {
$num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>';
print '<tr class="oddeven">';
print '<td>';
if ($row[0] == 'tobind') {
print $langs->trans("Unknown");
} else {
@ -473,20 +510,34 @@ if ($resql) {
print '<td>';
if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
} else {
print $row[1];
}
print '</td>';
for ($i = 2; $i <= 12; $i++) {
print '<td class="right nowraponall amount">'.price($row[$i]).'</td>';
for ($i = 2; $i <= 13; $i++) {
$cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2);
if ($cursormonth > 12) {
$cursormonth -= 12;
}
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
print '<td class="right nowraponall amount">';
print price($row[$i]);
print '</td>';
}
print '<td class="right nowraponall amount">'.price($row[13]).'</td>';
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
print '</tr>';
}
$db->free($resql);
if ($num == 0) {
print '<tr class="oddeven"><td colspan="16">';
print '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
print '</td></tr>';
}
} else {
print $db->lasterror(); // Show last sql error
}

View File

@ -478,7 +478,6 @@ if ($result) {
print '</div>';
print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_desc" value="'.dol_escape_htmltag($search_desc).'"></td>';
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
@ -528,8 +527,12 @@ if ($result) {
while ($i < min($num_lines, $limit)) {
$objp = $db->fetch_object($result);
// product_type: 0 = service, 1 = product
// if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
$code_sell_l = '';
$code_sell_p = '';
$code_sell_t = '';
$thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name;
@ -579,6 +582,8 @@ if ($result) {
$code_sell_p_notset = '';
$code_sell_t_notset = '';
$suggestedid = 0;
$return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'customer');
if (!is_array($return) && $return<0) {
setEventMessage($accountingAccount->error, 'errors');
@ -586,34 +591,13 @@ if ($result) {
$suggestedid=$return['suggestedid'];
$suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor'];
$suggestedaccountingaccountbydefaultfor=$return['suggestedaccountingaccountbydefaultfor'];
$code_sell_l=$return['code_sell_l'];
$code_sell_p=$return['code_sell_p'];
$code_sell_t=$return['code_sell_t'];
$code_sell_l=$return['code_l'];
$code_sell_p=$return['code_p'];
$code_sell_t=$return['code_t'];
}
//var_dump($return);
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
if (!empty($objp->company_code_sell)) {
$objp->code_sell_t = $objp->company_code_sell;
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
$suggestedaccountingaccountfor = '';
}
}
// Manage Deposit
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT)) {
if ($objp->description == "(DEPOSIT)" || $objp->ftype == $facture_static::TYPE_DEPOSIT) {
$accountdeposittoventilated = new AccountingAccount($db);
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
$objp->code_sell_l = $accountdeposittoventilated->ref;
$objp->code_sell_p = '';
$objp->code_sell_t = '';
$objp->aarowid_suggest = $accountdeposittoventilated->rowid;
}
}
if (!empty($objp->code_sell_p)) {
if (!empty($code_sell_p)) {
// Value was defined previously
} else {
$code_sell_p_notset = 'color:orange';
@ -628,6 +612,7 @@ if ($result) {
// $code_sell_l is now default code of product/service
// $code_sell_p is now code of product/service
// $code_sell_t is now code of thirdparty
//var_dump($code_sell_l.' - '.$code_sell_p.' - '.$code_sell_t.' -> '.$suggestedid.' ('.$suggestedaccountingaccountbydefaultfor.' '.$suggestedaccountingaccountfor.')');
print '<tr class="oddeven">';
@ -661,11 +646,11 @@ if ($result) {
print '</td>';
// Vat rate
$code_vat_differ='';
if ($product_static->tva_tx !== $facture_static_det->tva_tx && ! empty($facture_static_det->tva_tx)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
$code_vat_differ = '';
if ($product_static->tva_tx !== $facture_static_det->tva_tx && price2num($product_static->tva_tx) && price2num($facture_static_det->tva_tx)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
$code_vat_differ = 'warning bold';
}
print '<td style="'.$code_vat_differ.'" class="right">';
print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">';
print vatrate($facture_static_det->tva_tx.($facture_static_det->vat_src_code ? ' ('.$facture_static_det->vat_src_code.')' : ''));
print '</td>';
@ -731,12 +716,11 @@ if ($result) {
// Column with checkbox
print '<td class="center">';
if (!empty($suggestedid) && $suggestedaccountingaccountfor <> '') {
$ischecked=1;
} elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') {
$ischecked = 0;
$ischecked = 0;
if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
$ischecked = 1;
}
print '<input type="checkbox" class="flat checkforselect checkforselect'.$facture_static_det->id.'" name="toselect[]" value="'.$facture_static_det->id."_".$i.'"'.($ischecked ? "checked" : "").'/>';
print '<input type="checkbox" class="flat checkforselect checkforselect'.$facture_static_det->id.'" name="toselect[]" value="'.$facture_static_det->id."_".$i.'"'.($ischecked ? " checked" : "").'/>';
print '</td>';
print '</tr>';

View File

@ -32,6 +32,9 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
// Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "other", "accountancy"));
$validatemonth = GETPOST('validatemonth', 'int');
$validateyear = GETPOST('validateyear', 'int');
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
if (GETPOST("year", 'int')) {
$year_start = GETPOST("year", 'int');
@ -106,12 +109,18 @@ if ($action == 'validatehistory') {
$sql1 .= " WHERE ".MAIN_DB_PREFIX."expensereport_det.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
$sql1 .= " AND accnt.active = 1 AND t.accountancy_code = accnt.account_number";
$sql1 .= " AND ".MAIN_DB_PREFIX."expensereport_det.fk_code_ventilation = 0";
if ($validatemonth && $validateyear) {
$sql1 .= dolSqlDateFilter('date', 0, $validatemonth, $validateyear);
}
} else {
$sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd, ".MAIN_DB_PREFIX."c_type_fees as t, ".MAIN_DB_PREFIX."accounting_account as accnt , ".MAIN_DB_PREFIX."accounting_system as syst";
$sql1 .= " SET erd.fk_code_ventilation = accnt.rowid";
$sql1 .= " WHERE erd.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
$sql1 .= " AND accnt.active = 1 AND t.accountancy_code=accnt.account_number";
$sql1 .= " AND erd.fk_code_ventilation = 0";
if ($validatemonth && $validateyear) {
$sql1 .= dolSqlDateFilter('erd.date', 0, $validatemonth, $validateyear);
}
}
dol_syslog('htdocs/accountancy/expensereport/index.php');
@ -146,7 +155,7 @@ print '</span><br>';
$y = $year_current;
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?year='.$year_current.'&action=validatehistory">'.$langs->trans("ValidateHistory").'</a>';
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.$langs->trans("ValidateHistory").'</a>';
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
@ -195,7 +204,8 @@ if ($resql) {
$num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>';
print '<tr class="oddeven">';
print '<td>';
if ($row[0] == 'tobind') {
print '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>';
} else {
@ -204,15 +214,16 @@ if ($resql) {
print '</td>';
print '<td>';
if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
} else {
print $row[1];
}
print '</td>';
for ($i = 2; $i <= 12; $i++) {
print '<td class="right nowraponall amount">'.price($row[$i]).'</td>';
for ($i = 2; $i <= 13; $i++) {
print '<td class="right nowraponall amount">';
print price($row[$i]);
print '</td>';
}
print '<td class="right nowraponall amount">'.price($row[13]).'</td>';
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
print '</tr>';
}
@ -274,7 +285,8 @@ if ($resql) {
$num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>';
print '<tr class="oddeven">';
print '<td>';
if ($row[0] == 'tobind') {
print '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>';
} else {
@ -284,15 +296,16 @@ if ($resql) {
print '<td>';
if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
} else {
print $row[1];
}
print '</td>';
for ($i = 2; $i <= 12; $i++) {
print '<td class="right nowraponall amount">'.price($row[$i]).'</td>';
for ($i = 2; $i <= 13; $i++) {
print '<td class="right nowraponall amount">';
print price($row[$i]);
print '</td>';
}
print '<td class="right nowraponall amount">'.price($row[13]).'</td>';
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
print '</tr>';
}

View File

@ -34,6 +34,9 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
// Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "other", "accountancy"));
$validatemonth = GETPOST('validatemonth', 'int');
$validateyear = GETPOST('validateyear', 'int');
// Security check
if (empty($conf->accounting->enabled)) {
accessforbidden();
@ -172,6 +175,9 @@ if ($action == 'validatehistory') {
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
}
if ($validatemonth && $validateyear) {
$sql .= dolSqlDateFilter('f.datef', 0, $validatemonth, $validateyear);
}
dol_syslog('htdocs/accountancy/supplier/index.php');
@ -241,30 +247,23 @@ if ($action == 'validatehistory') {
$code_buy_p_notset = '';
$code_buy_t_notset = '';
$suggestedid = 0;
$return = $accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'supplier');
if (!is_array($return) && $return<0) {
setEventMessage($accountingAccount->error, 'errors');
} else {
$suggestedid=$return['suggestedid'];
$suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor'];
$suggestedid = $return['suggestedid'];
$suggestedaccountingaccountfor = $return['suggestedaccountingaccountfor'];
if (!empty($suggestedid) && $suggestedaccountingaccountfor<>'') {
$suggestedid=$return['suggestedid'];
if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
$suggestedid = $return['suggestedid'];
} else {
$suggestedid=0;
$suggestedid = 0;
}
}
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($objp->company_code_buy)) {
$objp->code_buy_t = $objp->company_code_buy;
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
$suggestedaccountingaccountfor = '';
}
}
if ($objp->aarowid_suggest > 0) {
if ($suggestedid > 0) {
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
$sqlupdate .= " SET fk_code_ventilation = ".((int) $suggestedid);
$sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".((int) $facture_static_det->id);
@ -307,7 +306,7 @@ print '</span><br>';
$y = $year_current;
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?year='.$year_current.'&action=validatehistory">'.$langs->trans("ValidateHistory").'</a>';
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.$langs->trans("ValidateHistory").'</a>';
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
@ -322,7 +321,24 @@ for ($i = 1; $i <= 12; $i++) {
if ($j > 12) {
$j -= 12;
}
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
$cursormonth = $j;
if ($cursormonth > 12) {
$cursormonth -= 12;
}
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
print '<td width="60" class="right">';
if (!empty($tmp['mday'])) {
$param = 'search_date_startday=1&search_date_startmonth='.$cursormonth.'&search_date_startyear='.$cursoryear;
$param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year'];
print '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/list.php?'.$param.'">';
}
print $langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT));
if (!empty($tmp['mday'])) {
print '</a>';
}
print '</td>';
}
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
@ -357,7 +373,8 @@ if ($resql) {
$num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>';
print '<tr class="oddeven">';
print '<td>';
if ($row[0] == 'tobind') {
print '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>';
} else {
@ -366,19 +383,26 @@ if ($resql) {
print '</td>';
print '<td>';
if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
} else {
print $row[1];
}
print '</td>';
for ($i = 2; $i <= 12; $i++) {
print '<td class="right nowraponall amount">'.price($row[$i]).'</td>';
for ($i = 2; $i <= 13; $i++) {
print '<td class="right nowraponall amount">';
print price($row[$i]);
print '</td>';
}
print '<td class="right nowraponall amount">'.price($row[13]).'</td>';
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
print '</tr>';
}
$db->free($resql);
if ($num == 0) {
print '<tr class="oddeven"><td colspan="16">';
print '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
print '</td></tr>';
}
} else {
print $db->lasterror(); // Show last sql error
}
@ -401,7 +425,24 @@ for ($i = 1; $i <= 12; $i++) {
if ($j > 12) {
$j -= 12;
}
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
$cursormonth = $j;
if ($cursormonth > 12) {
$cursormonth -= 12;
}
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
print '<td width="60" class="right">';
if (!empty($tmp['mday'])) {
$param = 'search_date_startday=1&search_date_startmonth='.$cursormonth.'&search_date_startyear='.$cursoryear;
$param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year'];
print '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/lines.php?'.$param.'">';
}
print $langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT));
if (!empty($tmp['mday'])) {
print '</a>';
}
print '</td>';
}
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
@ -436,7 +477,8 @@ if ($resql) {
$num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>';
print '<tr class="oddeven">';
print '<td>';
if ($row[0] == 'tobind') {
print $langs->trans("Unknown");
} else {
@ -445,19 +487,26 @@ if ($resql) {
print '</td>';
print '<td>';
if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
} else {
print $row[1];
}
print '</td>';
for ($i = 2; $i <= 12; $i++) {
print '<td class="right nowraponall amount">'.price($row[$i]).'</td>';
for ($i = 2; $i <= 13; $i++) {
print '<td class="right nowraponall amount">';
print price($row[$i]);
print '</td>';
}
print '<td class="right nowraponall amount">'.price($row[13]).'</td>';
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
print '</tr>';
}
$db->free($resql);
if ($num == 0) {
print '<tr class="oddeven"><td colspan="16">';
print '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
print '</td></tr>';
}
} else {
print $db->lasterror(); // Show last sql error
}

View File

@ -529,11 +529,12 @@ if ($result) {
while ($i < min($num_lines, $limit)) {
$objp = $db->fetch_object($result);
// product_type: 0 = service ? 1 = product
// product_type: 0 = service, 1 = product
// if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
// 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 = '';
$code_buy_l = '';
$code_buy_p = '';
$code_buy_t = '';
$thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name;
@ -575,10 +576,6 @@ if ($result) {
$facturefourn_static_det->product_type = $objp->type_l;
$facturefourn_static_det->desc = $objp->description;
$code_buy_p_notset = '';
$code_buy_t_notset = '';
$objp->aarowid_suggest = ''; // Will be set later
$accountingAccountArray = array(
'dom'=>$objp->aarowid,
'intra'=>$objp->aarowid_intra,
@ -588,6 +585,8 @@ if ($result) {
$code_buy_p_notset = '';
$code_buy_t_notset = '';
$suggestedid = 0;
$return=$accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facturefourn_static, $facturefourn_static_det, $accountingAccountArray, 'supplier');
if (!is_array($return) && $return<0) {
setEventMessage($accountingAccount->error, 'errors');
@ -595,9 +594,9 @@ if ($result) {
$suggestedid=$return['suggestedid'];
$suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor'];
$suggestedaccountingaccountbydefaultfor=$return['suggestedaccountingaccountbydefaultfor'];
$code_buy_l=$return['code_buy_l'];
$code_buy_p=$return['code_buy_p'];
$code_buy_t=$return['code_buy_t'];
$code_buy_l=$return['code_l'];
$code_buy_p=$return['code_p'];
$code_buy_t=$return['code_t'];
}
//var_dump($return);
@ -616,6 +615,7 @@ if ($result) {
// $code_buy_l is now default code of product/service
// $code_buy_p is now code of product/service
// $code_buy_t is now code of thirdparty
//var_dump($code_buy_l.' - '.$code_buy_p.' - '.$code_buy_t.' -> '.$suggestedid.' ('.$suggestedaccountingaccountbydefaultfor.' '.$suggestedaccountingaccountfor.')');
print '<tr class="oddeven">';
@ -654,11 +654,11 @@ if ($result) {
print '</td>';
// Vat rate
$code_vat_differ='';
if ($objp->vat_tx_l != $objp->vat_tx_p && ! empty($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
$code_vat_differ = '';
if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
$code_vat_differ = 'warning bold';
}
print '<td style="'.$code_vat_differ.'" class="right">';
print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">';
print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''));
print '</td>';
@ -691,6 +691,11 @@ if ($result) {
$shelp = ''; $ttype = 'help';
if ($suggestedaccountingaccountfor == 'eec') {
$shelp = $langs->trans("SaleEEC");
} elseif ($suggestedaccountingaccountfor == 'eecwithvat') {
$shelp = $langs->trans("SaleEECWithVAT");
} elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') {
$shelp = $langs->trans("SaleEECWithoutVATNumber");
$ttype = 'warning';
} elseif ($suggestedaccountingaccountfor == 'export') {
$shelp = $langs->trans("SaleExport");
}
@ -719,12 +724,11 @@ if ($result) {
// Column with checkbox
print '<td class="center">';
if (!empty($suggestedid)) {
$ischecked = 0;
if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
$ischecked = 1;
} else {
$ischecked = 0;
}
print '<input type="checkbox" class="flat checkforselect checkforselect'.$facturefourn_static_det->id.'" name="toselect[]" value="'.$facturefourn_static_det->id."_".$i.'"'.($ischecked ? "checked" : "").'/>';
print '<input type="checkbox" class="flat checkforselect checkforselect'.$facturefourn_static_det->id.'" name="toselect[]" value="'.$facturefourn_static_det->id."_".$i.'"'.($ischecked ? " checked" : "").'/>';
print '</td>';
print '</tr>';

View File

@ -265,7 +265,7 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
print '<div class="urllink">';
print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/members/new.php'.$entity_qr.'">';
print '<a target="_blank" href="'.$urlwithroot.'/public/members/new.php'.$entity_qr.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/members/new.php'.$entity_qr.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
print '</div>';
print ajax_autoselect('publicurlmember');
}

View File

@ -14,6 +14,7 @@
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
* Copyright (C) 2021 Philippe Grand <philippe.grand@atoo-net.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
@ -1520,7 +1521,7 @@ class Adherent extends CommonObject
{
global $langs;
require_once DOL_DOCUMENT_ROOT.'/parntership/class/partnership.class.php';
require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
$this->partnerships[] = array();
@ -2703,7 +2704,7 @@ class Adherent extends CommonObject
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
}
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) {
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption)
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 'openldap'); // Create OpenLDAP password (see LDAP_PASSWORD_HASH_TYPE)
}
} elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') {
// Set LDAP password if possible
@ -2714,7 +2715,7 @@ class Adherent extends CommonObject
if ($this->pass_indatabase_crypted && !empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) {
// Create OpenLDAP MD5 password from Dolibarr MD5 password
// Note: This suppose that "pass_indatabase_crypted" is a md5 (guaranted by the previous test if "(empty($conf->global->MAIN_SECURITY_HASH_ALGO))"
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = '{md5}'.base64_encode(hex2bin($this->pass_indatabase_crypted));
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dolGetLdapPasswordHash($this->pass_indatabase_crypted, 'md5frommd5');
}
}
} elseif (!empty($this->pass_indatabase)) {
@ -2723,7 +2724,7 @@ class Adherent extends CommonObject
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte
}
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) {
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); // md5 for OpenLdap TODO add type of encryption
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 'openldap'); // Create OpenLDAP password (see LDAP_PASSWORD_HASH_TYPE)
}
}
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006-2021 Regis Houssin <regis.houssin@inodbox.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
@ -50,14 +50,14 @@ if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref);
// Define variables to know what current user can do on users
$canadduser = ($user->admin || $user->rights->user->user->creer);
$canadduser = (!empty($user->admin) || !empty($user->rights->user->user->creer));
// Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
$caneditfielduser = ((($user->id == $object->user_id) && !empty($user->rights->user->self->creer))
|| (($user->id != $object->user_id) && !empty($user->rights->user->user->creer)));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
|| (($user->id != $object->user_id) && !empty($user->rights->user->user->password)));
}
}
@ -135,17 +135,17 @@ $adht->fetch($object->typeid);
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
// LDAP DN
print '<tr><td>LDAP '.$langs->trans("LDAPMemberDn").'</td><td class="valeur">'.$conf->global->LDAP_MEMBER_DN."</td></tr>\n";
print '<tr><td>LDAP '.$langs->trans("LDAPMemberDn").'</td><td class="valeur">'.getDolGlobalString('LDAP_MEMBER_DN')."</td></tr>\n";
// LDAP Cle
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur">'.$conf->global->LDAP_KEY_MEMBERS."</td></tr>\n";
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur">'.getDolGlobalString('LDAP_KEY_MEMBERS')."</td></tr>\n";
// LDAP Server
print '<tr><td>LDAP '.$langs->trans("Type").'</td><td class="valeur">'.$conf->global->LDAP_SERVER_TYPE."</td></tr>\n";
print '<tr><td>LDAP '.$langs->trans("Version").'</td><td class="valeur">'.$conf->global->LDAP_SERVER_PROTOCOLVERSION."</td></tr>\n";
print '<tr><td>LDAP '.$langs->trans("LDAPPrimaryServer").'</td><td class="valeur">'.$conf->global->LDAP_SERVER_HOST."</td></tr>\n";
print '<tr><td>LDAP '.$langs->trans("LDAPSecondaryServer").'</td><td class="valeur">'.$conf->global->LDAP_SERVER_HOST_SLAVE."</td></tr>\n";
print '<tr><td>LDAP '.$langs->trans("LDAPServerPort").'</td><td class="valeur">'.$conf->global->LDAP_SERVER_PORT."</td></tr>\n";
print '<tr><td>LDAP '.$langs->trans("Type").'</td><td class="valeur">'.getDolGlobalString('LDAP_SERVER_TYPE')."</td></tr>\n";
print '<tr><td>LDAP '.$langs->trans("Version").'</td><td class="valeur">'.getDolGlobalString('LDAP_SERVER_PROTOCOLVERSION')."</td></tr>\n";
print '<tr><td>LDAP '.$langs->trans("LDAPPrimaryServer").'</td><td class="valeur">'.getDolGlobalString('LDAP_SERVER_HOST')."</td></tr>\n";
print '<tr><td>LDAP '.$langs->trans("LDAPSecondaryServer").'</td><td class="valeur">'.getDolGlobalString('LDAP_SERVER_HOST_SLAVE')."</td></tr>\n";
print '<tr><td>LDAP '.$langs->trans("LDAPServerPort").'</td><td class="valeur">'.getDolGlobalString('LDAP_SERVER_PORT')."</td></tr>\n";
print '</table>';
@ -158,13 +158,13 @@ print dol_get_fiche_end();
*/
print '<div class="tabsAction">';
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') {
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && getDolGlobalString('LDAP_MEMBER_ACTIVE') != Ldap::SYNCHRO_LDAP_TO_DOLIBARR) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a></div>';
}
print "</div>\n";
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') {
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && getDolGlobalString('LDAP_MEMBER_ACTIVE') != Ldap::SYNCHRO_LDAP_TO_DOLIBARR) {
print "<br>\n";
}

View File

@ -943,7 +943,7 @@ if ($rowid > 0) {
}
if (!$datefrom) {
$datefrom = $object->datevalid;
if ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) < dol_now()) {
if ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) > dol_now()) {
$datefrom = dol_time_plus_duree($object->datefin, 1, 'd');
} else {
$datefrom = dol_get_first_day(dol_print_date(time(), "%Y"));

View File

@ -311,6 +311,7 @@ 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 '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="date_select" value="'.$date_select.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $subscription->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);

View File

@ -124,13 +124,13 @@ print dol_get_fiche_end();
print '<div class="tabsAction">';
if ($conf->global->LDAP_MEMBER_TYPE_ACTIVE == 1) {
if (getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
}
print "</div>\n";
if ($conf->global->LDAP_MEMBER_TYPE_ACTIVE == 1) {
if (getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
print "<br>\n";
}

View File

@ -159,7 +159,7 @@ $getentity = ($conf->entity > 1 ? "&entity=".$conf->entity : "");
// Show message
$message = '';
$urlvcal = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">';
$urlvcal = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank" rel="noopener noreferrer">';
$urlvcal .= $urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlvcal, '<span class="opacitymedium">'.$langs->trans("WebCalUrlForVCalExport", 'vcal', '').'</span>');
$message .= '<div class="urllink">';
@ -168,7 +168,7 @@ $message .= '</div>';
$message .= ajax_autoselect('onlinepaymenturl1');
$message .= '<br>';
$urlical = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">';
$urlical = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank" rel="noopener noreferrer">';
$urlical .= $urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlical, '<span class="opacitymedium">'.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', '').'</span>');
$message .= '<div class="urllink">';
@ -177,7 +177,7 @@ $message .= '</div>';
$message .= ajax_autoselect('onlinepaymenturl2');
$message .= '<br>';
$urlrss = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">';
$urlrss = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank" rel="noopener noreferrer">';
$urlrss .= $urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlrss, '<span class="opacitymedium">'.$langs->trans("WebCalUrlForVCalExport", 'rss', '').'</span>');
$message .= '<div class="urllink">';

View File

@ -175,9 +175,9 @@ if ($action == 'switch') {
$newfirst = $objto->box_order;
$newsecond = $objfrom->box_order;
if ($newfirst == $newsecond) {
$newsecondchar = preg_replace('/[0-9]+/', '', $newsecond);
$newsecondnum = preg_replace('/[a-zA-Z]+/', '', $newsecond);
$newsecond = sprintf("%s%02d", $newsecondchar ? $newsecondchar : 'A', $newsecondnum + 1);
$newsecondchar = preg_replace('/[0-9]+/', '', $newsecond);
$newsecondnum = preg_replace('/[a-zA-Z]+/', '', $newsecond);
$newsecond = sprintf("%s%02d", $newsecondchar ? $newsecondchar : 'A', $newsecondnum + 1);
}
$sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($newfirst)."' WHERE rowid=".((int) $objfrom->rowid);
@ -300,14 +300,13 @@ $boxtoadd = InfoBox::listBoxes($db, 'available', -1, null, $actives);
// Activated boxes
$boxactivated = InfoBox::listBoxes($db, 'activated', -1, null);
print "<br>\n";
print "\n\n".'<!-- Boxes Available -->'."\n";
print load_fiche_titre($langs->trans("BoxesAvailable"), '', '');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
print '<input type="hidden" name="action" value="add">'."\n";
print '<br>';
print '<div class="div-table-responsive-no-min">';
print '<table class="tagtable liste centpercent">'."\n";
@ -315,9 +314,12 @@ print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Box").'</td>';
print '<td>'.$langs->trans("Note").'/'.$langs->trans("Parameters").'</td>';
print '<td></td>';
print '<td width="160" class="center">'.$langs->trans("ActivatableOn").'</td>';
print "</tr>\n";
print '<td class="center" width="160">'.$langs->trans("ActivatableOn").'</td>';
print '<td class="center" width="60" colspan="2">'.$langs->trans("PositionByDefault").'</td>';
print '<td class="center" width="80">'.$langs->trans("Disable").'</td>';
print '</tr>'."\n";
print "\n\n".'<!-- Boxes Available -->'."\n";
foreach ($boxtoadd as $box) {
if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg)) {
$logo = $box->boximg;
@ -326,8 +328,8 @@ foreach ($boxtoadd as $box) {
}
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
print '<tr class="oddeven">'."\n";
print '<td>'.img_object("", $logo, 'height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel);
print '<tr class="oddeven" style="height:3em !important;">'."\n";
print '<td class="tdoverflowmax300" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv($box->boxlabel)).'">'.img_object("", $logo, 'class="pictofixedwidth" height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel);
if (!empty($box->class) && preg_match('/graph_/', $box->class)) {
print img_picto('', 'graph', 'class="paddingleft"');
}
@ -339,7 +341,7 @@ foreach ($boxtoadd as $box) {
}
}
print '</td>'."\n";
print '<td>';
print '<td class="tdoverflowmax300" title="'.dol_escape_htmltag($box->note).'">';
if ($box->note == '(WarningUsingThisBoxSlowDown)') {
$langs->load("errors");
print $langs->trans("WarningUsingThisBoxSlowDown");
@ -357,36 +359,21 @@ foreach ($boxtoadd as $box) {
print '<input type="hidden" name="boxid['.$box->box_id.'][value]" value="'.$box->box_id.'">'."\n";
print '</td>';
print '<td>';
print '</td>';
print '<td>';
print '</td>';
print '<td>';
print '<input type="submit" class="button small smallpaddingimp" value="'.$langs->trans("Activate").'">';
print '</td>';
print '</tr>'."\n";
}
if (!count($boxtoadd) && count($boxactivated)) {
print '<tr><td colspan="4"><span class="opacitymedium">'.$langs->trans("AllWidgetsWereEnabled").'</span></td></tr>';
}
print '</table>'."\n";
print '</div>';
print '<div class="right">';
print '<input type="submit" class="button"'.(count($boxtoadd) ? '' : ' disabled').' value="'.$langs->trans("Activate").'">';
print '</div>'."\n";
print '</form>';
print "\n".'<!-- End Boxes Available -->'."\n";
//var_dump($boxactivated);
print "<br>\n\n";
print load_fiche_titre($langs->trans("BoxesActivated"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="tagtable liste">'."\n";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Box").'</td>';
print '<td>'.$langs->trans("Note").'/'.$langs->trans("Parameters").'</td>';
print '<td class="center" width="160">'.$langs->trans("ActivatableOn").'</td>';
print '<td class="center" width="60" colspan="2">'.$langs->trans("PositionByDefault").'</td>';
print '<td class="center" width="80">'.$langs->trans("Disable").'</td>';
print '</tr>'."\n";
$box_order = 1;
$foundrupture = 1;
foreach ($boxactivated as $key => $box) {
@ -397,8 +384,8 @@ foreach ($boxactivated as $key => $box) {
}
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
print '<tr class="oddeven">';
print '<td>'.img_object("", $logo, 'height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel);
print '<tr class="oddeven" style="height:3em !important;">';
print '<td>'.img_object("", $logo, 'class="pictofixedwidth" height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel);
if (!empty($box->class) && preg_match('/graph_/', $box->class)) {
print img_picto('', 'graph', 'class="paddingleft"');
}
@ -410,14 +397,17 @@ foreach ($boxactivated as $key => $box) {
}
}
print '</td>';
print '<td>';
$langs->load("errors");
print '<td class="tdoverflowmax300" title="'.dol_escape_htmltag($box->note == '(WarningUsingThisBoxSlowDown)' ? $langs->trans("WarningUsingThisBoxSlowDown") : $box->note).'">';
if ($box->note == '(WarningUsingThisBoxSlowDown)') {
$langs->load("errors");
print img_warning('', 0).' '.$langs->trans("WarningUsingThisBoxSlowDown");
} else {
print ($box->note ? $box->note : '&nbsp;');
}
print '</td>';
print '<td>';
print $form->textwithpicto('', $langs->trans("SourceFile").' : '.$box->sourcefile);
print '</td>'."\n";
print '<td class="center">'.(empty($arrayofhomepages[$box->position]) ? '' : $langs->trans($arrayofhomepages[$box->position])).'</td>';
$hasnext = ($key < (count($boxactivated) - 1));
$hasprevious = ($key != 0);
@ -437,6 +427,8 @@ print '</table>';
print '</div>';
print '<br>';
print '</form>';
// Other parameters

View File

@ -108,7 +108,10 @@ print '<input type="hidden" name="action" value="update">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">';
print '<td class="titlefieldcreate">'.$langs->trans("SocialNetworksInformation").'</td><td>'.$langs->trans("Url").'</td><td>'.$langs->trans("SocialNetworkId").'</td><td></td>';
print '<td class="titlefieldcreate">'.$langs->trans("SocialNetworksInformation").'</td>';
print '<td>'.$langs->trans("SocialNetworkId").'</td>';
print '<td>'.$form->textwithpicto($langs->trans("Url"), $langs->trans("KeepEmptyToUseDefault")).'</td>';
print '<td></td>';
print "</tr>\n";
@ -119,9 +122,9 @@ foreach ($listofnetworks as $key => $value) {
$networkconstname = 'MAIN_INFO_SOCIETE_'.strtoupper($key).'_URL';
$networkconstid = 'MAIN_INFO_SOCIETE_'.strtoupper($key);
print '<td class="nowraponall"><span class="fa paddingright '.($value['icon'] ? $value['icon'] : 'fa-link').'"></span>';
print '<input name="'.$key.'url" id="'.$key.'url" class="minwidth300" value="'.(!empty($conf->global->$networkconstname) ? dol_escape_htmltag($conf->global->$networkconstname) : '').'">';
print '</td><td>';
print '<input name="'.$key.'" id="'.$key.'" class="minwidth300" value="'.(!empty($conf->global->$networkconstid) ? dol_escape_htmltag($conf->global->$networkconstid) : '').'">';
print '</td><td>';
print '<input name="'.$key.'url" id="'.$key.'url" class="minwidth300" value="'.(!empty($conf->global->$networkconstname) ? dol_escape_htmltag($conf->global->$networkconstname) : '').'">';
print '</td>';
print '<td class="nowraponall">'.dol_print_socialnetworks((!empty($conf->global->$networkconstid) ? dol_escape_htmltag($conf->global->$networkconstid) : ''), 0, 0, $key, $listofnetworks).'</td>';
print '</tr>'."\n";

View File

@ -173,11 +173,11 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
// Show message
$message = '';
$url = '<a href="'.$urlwithroot.'/dav/fileserver.php" target="_blank">'.$urlwithroot.'/dav/fileserver.php</a>';
$url = '<a href="'.$urlwithroot.'/dav/fileserver.php" target="_blank" rel="noopener noreferrer">'.$urlwithroot.'/dav/fileserver.php</a>';
$message .= img_picto('', 'globe').' '.str_replace('{url}', $url, $langs->trans("WebDavServer", 'WebDAV', ''));
$message .= '<div class="urllink"><input type="text" id="webdavpublicurl" class="quatrevingtpercent" value="'.$urlwithroot.'/dav/fileserver.php">';
$message .= '<a href="'.$urlwithroot.'/dav/fileserver.php" target="_blank">';
$message .= '<a href="'.$urlwithroot.'/dav/fileserver.php" target="_blank" rel="noopener noreferrer">';
$message .= ' '.img_picto('', 'globe');
$message .= '</a>';
$message .= '</div>';
@ -186,11 +186,11 @@ $message .= ajax_autoselect('webdavpublicurl');
$message .= '<br>';
if (!empty($conf->global->DAV_ALLOW_PUBLIC_DIR)) {
$urlEntity = (!empty($conf->multicompany->enabled) ? '?entity='.$conf->entity : '');
$url = '<a href="'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'" target="_blank">'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'</a>';
$url = '<a href="'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'" target="_blank" rel="noopener noreferrer">'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'</a>';
$message .= img_picto('', 'globe').' '.str_replace('{url}', $url, $langs->trans("WebDavServer", 'WebDAV public', ''));
$message .= '<div class="urllink"><input type="text" id="webdavurl" class="quatrevingtpercent" value="'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'">';
$message .= '<a href="'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'" target="_blank">';
$message .= '<a href="'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'" target="_blank" rel="noopener noreferrer">';
$message .= ' '.img_picto('', 'globe');
$message .= '</a>';
$message .= '</div>';

View File

@ -268,7 +268,7 @@ class Dolistore
// add image or default ?
if ($product->id_default_image != '') {
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.((int) $product->id).'&id_image='.((int) $product->id_default_image);
$images = '<a href="'.urlencode($image_url).'" class="documentpreview" target="_blank" mime="image/png" title="'.dol_escape_htmltag($product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version).'">';
$images = '<a href="'.urlencode($image_url).'" class="documentpreview" target="_blank" rel="noopener noreferrer" mime="image/png" title="'.dol_escape_htmltag($product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version).'">';
$images .= '<img src="'.urlencode($image_url).'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
} else {
$images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />';
@ -280,8 +280,8 @@ class Dolistore
$download_link = '<a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
} else {
$price = '<h3>'.$langs->trans('Free').'</h3>';
$download_link = '<a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>';
$download_link .= '<br><br><a target="_blank" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
$download_link = '<a target="_blank" rel="noopener noreferrer" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>';
$download_link .= '<br><br><a target="_blank" rel="noopener noreferrer" href="'.urlencode($this->shop_url.$product->id).'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
}
//checking versions
@ -316,8 +316,6 @@ class Dolistore
$compatible = 'NotCompatible';
}
//.'<br><a class="inline-block valignmiddle" target="_blank" href="'.$this->shop_url.$product->id.'"><span class="details button">'.$langs->trans("SeeInMarkerPlace").'</span></a>
//output template
$html .= '<tr class="app oddeven '.dol_escape_htmltag($compatible).'">
<td class="center" width="210"><div class="newAppParent">'.dol_escape_htmltag($newapp.$images).'</div></td>

View File

@ -583,6 +583,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$arrayoftypes = array(
'loadthirdparty'=>$langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")),
'loadandcreatethirdparty'=>$langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")),
'recordjoinpiece'=>$langs->trans('recordjoinpieceonobject'),
'recordevent'=>'RecordEvent');
if ($conf->projet->enabled) {
$arrayoftypes['project'] = 'CreateLeadAndThirdParty';

View File

@ -5,7 +5,7 @@
*
* 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 2 of the License, or
* 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,

View File

@ -6,7 +6,7 @@
*
* 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 2 of the License, or
* 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,

View File

@ -144,12 +144,12 @@ print '<br>';
print $langs->trans("NoteOnPathLocation").'<br>';
$url1 = 'http://www.maxmind.com/en/city?rId=awstats';
print $langs->trans("YouCanDownloadFreeDatFileTo", '<a href="'.$url1.'" target="_blank">'.$url1.'</a>');
print $langs->trans("YouCanDownloadFreeDatFileTo", '<a href="'.$url1.'" target="_blank" rel="noopener noreferrer external">'.$url1.'</a>');
print '<br>';
$url2 = 'http://www.maxmind.com/en/city?rId=awstats';
print $langs->trans("YouCanDownloadAdvancedDatFileTo", '<a href="'.$url2.'" target="_blank">'.$url2.'</a>');
print $langs->trans("YouCanDownloadAdvancedDatFileTo", '<a href="'.$url2.'" target="_blank" rel="noopener noreferrer external">'.$url2.'</a>');
if ($geoip) {
print '<br><br>';

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2005-2021 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
*
@ -29,10 +29,11 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formldap.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ldap.lib.php';
// Load translation files required by the page
$langs->load("admin");
$langs->loadLangs(array("admin", "ldap"));
if (!$user->admin) {
accessforbidden();
@ -99,6 +100,9 @@ if (empty($reshook)) {
if (!dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_ACTIVE', GETPOST("activememberstypes", 'aZ09'), 'chaine', 0, '', $conf->entity)) {
$error++;
}
if (!dolibarr_set_const($db, 'LDAP_PASSWORD_HASH_TYPE', GETPOST("LDAP_PASSWORD_HASH_TYPE", 'aZ09'), 'chaine', 0, '', $conf->entity)) {
$error++;
}
if (!$error) {
$db->commit();
@ -129,7 +133,7 @@ if (!function_exists("ldap_connect")) {
$form = new Form($db);
$formldap = new FormLdap($db);
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newToken().'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
@ -146,13 +150,9 @@ print "</tr>\n";
// Synchro utilisateurs/groupes active
print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnSynchroActive").'</td><td>';
$arraylist = array();
$arraylist['0'] = $langs->trans("No");
$arraylist['ldap2dolibarr'] = $langs->trans("LDAPToDolibarr");
$arraylist['dolibarr2ldap'] = $langs->trans("DolibarrToLDAP");
print $form->selectarray('activesynchro', $arraylist, $conf->global->LDAP_SYNCHRO_ACTIVE);
print $formldap->selectLdapDnSynchroActive(getDolGlobalInt('LDAP_SYNCHRO_ACTIVE'), 'activesynchro');
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnSynchroActiveExample").'</span>';
if ($conf->global->LDAP_SYNCHRO_ACTIVE && !$conf->global->LDAP_USER_DN) {
if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && empty($conf->global->LDAP_USER_DN)) {
print '<br><span class="error">'.$langs->trans("LDAPSetupNotComplete").'</span>';
}
print '</td></tr>';
@ -160,32 +160,21 @@ print '</td></tr>';
// Synchro contact active
if (!empty($conf->societe->enabled)) {
print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnContactActive").'</td><td>';
$arraylist = array();
$arraylist['0'] = $langs->trans("No");
$arraylist['1'] = $langs->trans("DolibarrToLDAP");
print $form->selectarray('activecontact', $arraylist, $conf->global->LDAP_CONTACT_ACTIVE);
print $formldap->selectLdapDnSynchroActive(getDolGlobalInt('LDAP_CONTACT_ACTIVE'), 'activecontact', array(Ldap::SYNCHRO_LDAP_TO_DOLIBARR));
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnContactActiveExample").'</span></td></tr>';
}
// Synchro member active
if (!empty($conf->adherent->enabled)) {
print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnMemberActive").'</td><td>';
$arraylist = array();
$arraylist['0'] = $langs->trans("No");
$arraylist['1'] = $langs->trans("DolibarrToLDAP");
$arraylist['ldap2dolibarr'] = $langs->trans("LDAPToDolibarr").' ('.$langs->trans("SupportedForLDAPImportScriptOnly").')';
print $form->selectarray('activemembers', $arraylist, $conf->global->LDAP_MEMBER_ACTIVE);
print $formldap->selectLdapDnSynchroActive(getDolGlobalInt('LDAP_MEMBER_ACTIVE'), 'activemembers', array(), 2);
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnMemberActiveExample").'</span></td></tr>';
}
// Synchro member type active
if (!empty($conf->adherent->enabled)) {
print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnMemberTypeActive").'</td><td>';
$arraylist = array();
$arraylist['0'] = $langs->trans("No");
$arraylist['1'] = $langs->trans("DolibarrToLDAP");
$arraylist['ldap2dolibarr'] = $langs->trans("LDAPToDolibarr").' ('.$langs->trans("SupportedForLDAPImportScriptOnly").')';
print $form->selectarray('activememberstypes', $arraylist, $conf->global->LDAP_MEMBER_TYPE_ACTIVE);
print $formldap->selectLdapDnSynchroActive(getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE'), 'activememberstypes', array(), 2);
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnMemberTypeActiveExample").'</span></td></tr>';
}
@ -202,55 +191,46 @@ print "</tr>\n";
// Type
print '<tr class="oddeven"><td>'.$langs->trans("Type").'</td><td>';
$arraylist = array();
$arraylist['activedirectory'] = 'Active Directory';
$arraylist['openldap'] = 'OpenLdap';
$arraylist['egroupware'] = 'Egroupware';
print $form->selectarray('type', $arraylist, $conf->global->LDAP_SERVER_TYPE);
print $formldap->selectLdapServerType(getDolGlobalString('LDAP_SERVER_TYPE'), 'type');
print '</td><td>&nbsp;</td></tr>';
// Version
print '<tr class="oddeven"><td>'.$langs->trans("Version").'</td><td>';
$arraylist = array();
$arraylist['3'] = 'Version 3';
$arraylist['2'] = 'Version 2';
print $form->selectarray('LDAP_SERVER_PROTOCOLVERSION', $arraylist, $conf->global->LDAP_SERVER_PROTOCOLVERSION);
print $formldap->selectLdapServerProtocolVersion(getDolGlobalString('LDAP_SERVER_PROTOCOLVERSION'), 'LDAP_SERVER_PROTOCOLVERSION');
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPServerProtocolVersion").'</span></td></tr>';
// Serveur primaire
print '<tr class="oddeven"><td>';
print $langs->trans("LDAPPrimaryServer").'</td><td>';
print '<input class="minwidth200" type="text" name="host" value="'.$conf->global->LDAP_SERVER_HOST.'">';
print '<input class="minwidth200" type="text" name="host" value="'.getDolGlobalString('LDAP_SERVER_HOST').'">';
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPServerExample").'</span></td></tr>';
// Serveur secondaire
print '<tr class="oddeven"><td>';
print $langs->trans("LDAPSecondaryServer").'</td><td>';
print '<input class="minwidth200" type="text" name="slave" value="'.$conf->global->LDAP_SERVER_HOST_SLAVE.'">';
print '<input class="minwidth200" type="text" name="slave" value="'.getDolGlobalString('LDAP_SERVER_HOST_SLAVE').'">';
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPServerExample").'</span></td></tr>';
// Port
print '<tr class="oddeven"><td>'.$langs->trans("LDAPServerPort").'</td><td>';
if (!empty($conf->global->LDAP_SERVER_PORT)) {
print '<input class="width75" type="text" name="port" value="'.$conf->global->LDAP_SERVER_PORT.'">';
} else {
print '<input class="width75" type="text" name="port" value="389">';
}
print '<input class="width75" type="text" name="port" value="'.getDolGlobalString('LDAP_SERVER_PORT', '389').'">';
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPServerPortExample").'</span></td></tr>';
// DNserver
print '<tr class="oddeven"><td>'.$langs->trans("LDAPServerDn").'</td><td>';
print '<input class="minwidth300" type="text" name="dn" value="'.$conf->global->LDAP_SERVER_DN.'">';
print '<input class="minwidth300" type="text" name="dn" value="'.getDolGlobalString('LDAP_SERVER_DN').'">';
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPServerDnExample").'</span></td></tr>';
// Utiliser TLS
print '<tr class="oddeven"><td>'.$langs->trans("LDAPServerUseTLS").'</td><td>';
$arraylist = array();
$arraylist['0'] = $langs->trans("No");
$arraylist['1'] = $langs->trans("Yes");
print $form->selectarray('usetls', $arraylist, $conf->global->LDAP_SERVER_USE_TLS);
print $form->selectyesno('usetls', getDolGlobalInt('LDAP_SERVER_USE_TLS'), 1);
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPServerUseTLSExample").'</span></td></tr>';
// Password hash type
print '<tr class="oddeven"><td>'.$langs->trans("LDAPPasswordHashType").'</td><td>';
print $formldap->selectLdapPasswordHashType(getDolGlobalString('LDAP_PASSWORD_HASH_TYPE'), 'LDAP_PASSWORD_HASH_TYPE');
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPPasswordHashTypeExample").'</span></td></tr>';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("ForANonAnonymousAccess").'</td>';
print "</tr>\n";
@ -258,17 +238,13 @@ print "</tr>\n";
// DNAdmin
print '<!-- LDAP_ADMIN_DN -->';
print '<tr class="oddeven"><td>'.$langs->trans("LDAPAdminDn").'</td><td>';
print '<input class="minwidth300" type="text" name="admin" value="'.$conf->global->LDAP_ADMIN_DN.'">';
print '<input class="minwidth300" type="text" name="admin" value="'.getDolGlobalString('LDAP_ADMIN_DN').'">';
print '</td><td class="maxwidthhalf"><span class="opacitymedium">'.$langs->trans("LDAPAdminDnExample").'</span></td></tr>';
// Pass
print '<!-- LDAP_ADMIN_PASS -->';
print '<tr class="oddeven"><td>'.$langs->trans("LDAPPassword").'</td><td>';
if (!empty($conf->global->LDAP_ADMIN_PASS)) {
print '<input class="minwidth150" type="password" name="pass" value="'.$conf->global->LDAP_ADMIN_PASS.'">'; // je le met en visible pour test
} else {
print '<input class="minwidth150" type="text" name="pass" value="'.$conf->global->LDAP_ADMIN_PASS.'">';
}
print '<input class="minwidth150" type="password" name="pass" value="'.$conf->global->LDAP_ADMIN_PASS.'">';
print '</td><td><span class="opacitymedium">'.$langs->trans('Password').' (ex: secret)</span></td></tr>';
print '</table>';
@ -297,17 +273,17 @@ if (function_exists("ldap_connect")) {
if ($result > 0) {
// Test ldap connect and bind
print img_picto('', 'info').' ';
print '<span class="ok">'.$langs->trans("LDAPTCPConnectOK", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT).'</span>';
print '<span class="ok">'.$langs->trans("LDAPTCPConnectOK", $ldap->connectedServer, getDolGlobalString('LDAP_SERVER_PORT')).'</span>';
print '<br>';
if (!empty($conf->global->LDAP_ADMIN_DN) && !empty($conf->global->LDAP_ADMIN_PASS)) {
if ($result == 2) {
print img_picto('', 'info').' ';
print '<span class="ok">'.$langs->trans("LDAPBindOK", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
print '<span class="ok">'.$langs->trans("LDAPBindOK", $ldap->connectedServer, getDolGlobalString('LDAP_SERVER_PORT'), $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
print '<br>';
} else {
print img_picto('', 'error').' ';
print '<span class="error">'.$langs->trans("LDAPBindKO", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
print '<span class="error">'.$langs->trans("LDAPBindKO", $ldap->connectedServer, getDolGlobalString('LDAP_SERVER_PORT'), $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
print '<br>';
print $langs->trans("Error").' '.$ldap->error;
print '<br>';
@ -333,7 +309,7 @@ if (function_exists("ldap_connect")) {
$ldap->unbind();
} else {
print img_picto('', 'error').' ';
print '<span class="error">'.$langs->trans("LDAPTCPConnectKO", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT).'</span>';
print '<span class="error">'.$langs->trans("LDAPTCPConnectKO", $ldap->connectedServer, getDolGlobalString('LDAP_SERVER_PORT')).'</span>';
print '<br>';
print $langs->trans("Error").' '.$ldap->error;
print '<br>';

View File

@ -218,7 +218,7 @@ print '</form>';
/*
* Test de la connexion
*/
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
if (getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
$butlabel = $langs->trans("LDAPTestSynchroGroup");
$testlabel = 'testgroup';
$key = $conf->global->LDAP_KEY_GROUPS;
@ -226,7 +226,7 @@ if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
$objectclass = $conf->global->LDAP_GROUP_OBJECT_CLASS;
show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
} elseif ($conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') {
} elseif (getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR) {
$butlabel = $langs->trans("LDAPTestSearch");
$testlabel = 'testsearchgroup';
$key = $conf->global->LDAP_KEY_GROUPS;

View File

@ -188,7 +188,7 @@ print '</form>';
/*
* Test de la connexion
*/
if ($conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') {
if (getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE') === Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
$butlabel = $langs->trans("LDAPTestSynchroMemberType");
$testlabel = 'testmembertype';
$key = $conf->global->LDAP_KEY_MEMBERS_TYPES;

View File

@ -405,7 +405,7 @@ print '</form>';
/*
* Test de la connexion
*/
if (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') == 'dolibarr2ldap') {
if (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') == Ldap::SYNCHRO_DOLIBARR_TO_LDAP) {
$butlabel = $langs->trans("LDAPTestSynchroUser");
$testlabel = 'testuser';
$key = getDolGlobalString('LDAP_KEY_USERS');
@ -413,7 +413,7 @@ if (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') == 'dolibarr2ldap') {
$objectclass = getDolGlobalString('LDAP_USER_OBJECT_CLASS');
show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
} elseif (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') == 'ldap2dolibarr') {
} elseif (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') == Ldap::SYNCHRO_LDAP_TO_DOLIBARR) {
$butlabel = $langs->trans("LDAPTestSearch");
$testlabel = 'testsearchuser';
$key = getDolGlobalString('LDAP_KEY_USERS');

View File

@ -654,7 +654,7 @@ if ($action == 'view') {
if ($valuetoshow != '') {
print '<td class="'.$align.'">';
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
print '<a href="'.$tabhelp[$id][$value].'" target="_blank" rel="noopener noreferrer">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (!empty($tabhelp[$id][$value])) {
if (in_array($value, array('topic'))) {
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click

View File

@ -70,6 +70,9 @@ print '<!-- Force style container -->'."\n".'<style>
.id-container {
width: 100%;
}
#id-right {
padding-left: unset;
}
</style>';
$arrayofnatures = array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers"));
@ -331,7 +334,7 @@ if ($mode == 'desc') {
$editor_url = 'http://'.$editor_url;
}
if (!empty($objMod->editor_url) && !preg_match('/dolibarr\.org/i', $objMod->editor_url)) {
$textexternal .= ($objMod->editor_name != 'dolibarr' ? ' - ' : '').img_picto('', 'globe').' <a href="'.$editor_url.'" target="_blank">'.$objMod->editor_url.'</a>';
$textexternal .= ($objMod->editor_name != 'dolibarr' ? ' - ' : '').img_picto('', 'globe').' <a href="'.$editor_url.'" target="_blank" rel="noopener noreferrer external">'.$objMod->editor_url.'</a>';
}
$text .= $textexternal;
$text .= '<br>';

View File

@ -1000,9 +1000,9 @@ if ($mode == 'marketplace') {
print '<tr class="oddeven">'."\n";
$url = 'https://www.dolistore.com';
print '<td class="hideonsmartphone"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolistore_logo.png"></a></td>';
print '<td class="hideonsmartphone"><a href="'.$url.'" target="_blank" rel="noopener noreferrer external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolistore_logo.png"></a></td>';
print '<td><span class="opacitymedium">'.$langs->trans("DoliStoreDesc").'</span></td>';
print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
print '<td><a href="'.$url.'" target="_blank" rel="noopener noreferrer external">'.$url.'</a></td>';
print '</tr>';
print "</table>\n";
@ -1081,7 +1081,7 @@ if ($mode == 'deploy') {
$allowonlineinstall = false;
}
$fullurl = '<a href="'.$urldolibarrmodules.'" target="_blank">'.$urldolibarrmodules.'</a>';
$fullurl = '<a href="'.$urldolibarrmodules.'" target="_blank" rel="noopener noreferrer">'.$urldolibarrmodules.'</a>';
$message = '';
if (!empty($allowonlineinstall)) {
if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) {
@ -1273,10 +1273,10 @@ if ($mode == 'develop') {
print '<tr class="oddeven" height="80">'."\n";
$url = 'https://partners.dolibarr.org';
print '<td class="left">';
print'<a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner.png"></a>';
print'<a href="'.$url.'" target="_blank" rel="noopener noreferrer external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner.png"></a>';
print '</td>';
print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';
print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
print '<td><a href="'.$url.'" target="_blank" rel="noopener noreferrer external">'.$url.'</a></td>';
print '</tr>';
print "</table>\n";

View File

@ -169,6 +169,7 @@ $head = multicurrencyAdminPrepareHead();
print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "multicurrency");
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
@ -191,7 +192,7 @@ print '<tr class="oddeven">';
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_useOriginTx").'</td>';
print '<td class="center">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MULTICURRENCY_USE_ORIGIN_TX');
print ajax_constantonoff('MULTICURRENCY_USE_ORIGIN_TX', null, null, 0, 0, 0, 2, 0, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("MULTICURRENCY_USE_ORIGIN_TX", $arrval, $conf->global->MULTICURRENCY_USE_ORIGIN_TX);
@ -242,6 +243,7 @@ print '</td></tr>';
*/
print '</table>';
print '</div>';
print '<br>';
@ -264,7 +266,7 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) {
print '</td></tr>';
print '<tr class="oddeven">';
print '<td class="fieldrequired"><a target="_blank" href="'.$urlforapilayer.'">'.$langs->transnoentitiesnoconv("multicurrency_appId").'</a></td>';
print '<td class="fieldrequired"><a target="_blank" rel="noopener noreferrer external" href="'.$urlforapilayer.'">'.$langs->transnoentitiesnoconv("multicurrency_appId").'</a></td>';
print '<td class="right">';
print '<input type="text" name="MULTICURRENCY_APP_ID" value="'.$conf->global->MULTICURRENCY_APP_ID.'" size="28" />&nbsp;';
print '</td></tr>';
@ -290,7 +292,7 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) {
}
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<table class="noborder centpercent nomarginbottom">';
print '<tr class="liste_titre">';
print '<td>'.$form->textwithpicto($langs->trans("CurrenciesUsed"), $langs->transnoentitiesnoconv("CurrenciesUsed_help_to_add")).'</td>'."\n";
@ -305,7 +307,7 @@ print '<tr class="oddeven">';
print '<td>'.$form->selectCurrency('', 'code', 1).'</td>';
print '<td class="right">';
print '<input type="text" name="rate" value="" class="width75 right" placeholder="'.$langs->trans('Rate').'" />&nbsp;';
print '<input type="submit" class="button button-add" value="'.$langs->trans("Add").'">';
print '<input type="submit" class="button button-add small" value="'.$langs->trans("Add").'">';
print '</td>';
print '</tr>';

View File

@ -196,6 +196,12 @@ $arraydetailsforpdffoot = array(
3 => $langs->transnoentitiesnoconv('DisplayCompanyInfoAndManagers')
);
$arraylistofpdfformat = array(
0 => $langs->transnoentitiesnoconv('PDF 1.7'),
1 => $langs->transnoentitiesnoconv('PDF/A-1b'),
3 => $langs->transnoentitiesnoconv('PDF/A-3b'),
);
$s = $langs->trans("LibraryToBuildPDF")."<br>";
$i = 0;
$pdf = pdf_getInstance('A4');
@ -540,11 +546,7 @@ if ($conf->use_javascript_ajax) {
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PDF_USE_A").'</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('PDF_USE_A');
} else {
print $form->selectyesno('PDF_USE_A', (empty($conf->global->PDF_USE_A) ? 0 : $conf->global->PDF_USE_A), 1);
}
print $form->selectarray('PDF_USE_A', $arraylistofpdfformat, (empty($conf->global->PDF_USE_A) ? 0 : $conf->global->PDF_USE_A));
print '</td></tr>';
print '</table>';

View File

@ -72,8 +72,8 @@ print '</li></ul>';
print $langs->trans("Developpers").':';
print '<ul>';
print '<li>'.$langs->trans("SourcesRepository").': <a href="https://www.github.com/Dolibarr/dolibarr" target="_blank" rel="external">https://www.github.com/Dolibarr/dolibarr</a></li>';
print '<li>'.$langs->trans("SeeWikiForAllTeam").': <a href="https://wiki.dolibarr.org/index.php/Dolibarr_Project" target="_blank" rel="external">https://wiki.dolibarr.org/index.php/Dolibarr_Project</a></li>';
print '<li>'.$langs->trans("SourcesRepository").': <a href="https://www.github.com/Dolibarr/dolibarr" target="_blank" rel="noopener noreferrer external">https://www.github.com/Dolibarr/dolibarr</a></li>';
print '<li>'.$langs->trans("SeeWikiForAllTeam").': <a href="https://wiki.dolibarr.org/index.php/Dolibarr_Project" target="_blank" rel="noopener noreferrer external">https://wiki.dolibarr.org/index.php/Dolibarr_Project</a></li>';
print '</ul>';
//print "<br>\n";
@ -82,56 +82,56 @@ print $langs->trans("OtherInformations").':';
print '<ul>';
print '<li>';
print '<a target="_blank" href="https://www.dolibarr.org/" rel="external">'.$langs->trans("OfficialWebSite").'</a>';
print '<a target="_blank" href="https://www.dolibarr.org/" rel="noopener noreferrer external">'.$langs->trans("OfficialWebSite").'</a>';
print '</li>';
// Show local site
/*
if (preg_match('/^fr_/i', $langs->getDefaultLang()))
{
print '<li>';
print '<a target="_blank" href="https://www.dolibarr.fr/" rel="external">'.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("France")).'</a>';
print '<a target="_blank" href="https://www.dolibarr.fr/" rel="noopener noreferrer external">'.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("France")).'</a>';
print '</li>';
}
if (preg_match('/^el_/i', $langs->getDefaultLang()))
{
print '<li>';
print '<a target="_blank" href="https://www.dolibarr.gr/" rel="external">'.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Greece")).'</a>';
print '<a target="_blank" href="https://www.dolibarr.gr/" rel="noopener noreferrer external">'.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Greece")).'</a>';
print '</li>';
}
if (preg_match('/^es_/i', $langs->getDefaultLang()))
{
print '<li>';
print '<a target="_blank" href="https://www.dolibarr.es/" rel="external">'.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Spain")).'</a>';
print '<a target="_blank" href="https://www.dolibarr.es/" rel="noopener noreferrer external">'.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Spain")).'</a>';
print '</li>';
}
if (preg_match('/^it_/i', $langs->getDefaultLang()))
{
print '<li>';
print '<a target="_blank" href="https://www.dolibarr.it/" rel="external">'.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Italy")).'</a>';
print '<a target="_blank" href="https://www.dolibarr.it/" rel="noopener noreferrer external">'.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Italy")).'</a>';
print '</li>';
}
if (preg_match('/^de_/i', $langs->getDefaultLang()))
{
print '<li>';
print '<a target="_blank" href="https://www.dolibarr.de/" rel="external">'.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Germany")).'</a>';
print '<a target="_blank" href="https://www.dolibarr.de/" rel="noopener noreferrer external">'.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Germany")).'</a>';
print '</li>';
}*/
print '<li>';
print '<a target="_blank" href="https://wiki.dolibarr.org/" rel="external">'.$langs->trans("OfficialWiki").'</a>';
print '<a target="_blank" href="https://wiki.dolibarr.org/" rel="noopener noreferrer external">'.$langs->trans("OfficialWiki").'</a>';
print '</li>';
print '</ul>';
print $langs->trans("Demo").':';
print '<ul>';
print '<li>';
print '<a target="_blank" href="https://www.dolibarr.org/onlinedemo/" rel="external">'.$langs->trans("OfficialDemo").'</a>';
print '<a target="_blank" href="https://www.dolibarr.org/onlinedemo/" rel="noopener noreferrer external">'.$langs->trans("OfficialDemo").'</a>';
print '</li>';
print '</ul>';
print $langs->trans("ModulesMarketPlaces").':';
print '<ul>';
print '<li>';
print '<a target="_blank" href="https://www.dolistore.com" rel="external">'.$langs->trans("OfficialMarketPlace").'</a>';
print '<a target="_blank" href="https://www.dolistore.com" rel="noopener noreferrer external">'.$langs->trans("OfficialMarketPlace").'</a>';
print '</li>';
print '</ul>';
@ -143,7 +143,7 @@ print $langs->trans("HelpCenter").':';
print '<ul>';
print '<li>';
//print $langs->trans("SeeWikiPage",'http://wiki.dolibarr.org/index.php/List_of_OpenSource_Software_companies_and_freelancers');
print '<a target="_blank" href="'.DOL_URL_ROOT.'/support/index.php" data-ajax="false">'.$langs->trans("HelpCenter").'</a>';
print '<a target="_blank" rel="noopener noreferrer external" href="'.DOL_URL_ROOT.'/support/index.php" data-ajax="false">'.$langs->trans("HelpCenter").'</a>';
print '</li>';
print '</ul>';
@ -158,15 +158,15 @@ if (preg_match('/^fr_/i', $langs->getDefaultLang())) {
if (preg_match('/^es_/i', $langs->getDefaultLang())) {
$url = 'https://wiki.dolibarr.org/index.php/Subscribirse';
}
print '<li><a href="'.$url.'" target="_blank" rel="external">'.$langs->trans("SubscribeToFoundation").'</a></li>';
print '<li><a href="'.$url.'" target="_blank" rel="noopener noreferrer external">'.$langs->trans("SubscribeToFoundation").'</a></li>';
print '</ul>';
print $langs->trans("SocialNetworks").':';
print '<ul>';
print '<li><a href="https://facebook.com/dolibarr" target="_blank" rel="external">FaceBook</a></li>';
print '<li><a href="https://twitter.com/dolibarr" target="_blank" rel="external">Twitter</a></li>';
print '<li><a href="https://facebook.com/dolibarr" target="_blank" rel="noopener noreferrer external">FaceBook</a></li>';
print '<li><a href="https://twitter.com/dolibarr" target="_blank" rel="noopener noreferrer external">Twitter</a></li>';
print '</ul>';
@ -182,11 +182,11 @@ if (preg_match('/^es_/i', $langs->getDefaultLang())) {
$url = 'https://wiki.dolibarr.org/index.php/Soluciones_en_la_Nube';
}
print '<li>';
print '<a target="_blank" href="'.$url.'" rel="external">'.$title.'</a>';
print '<a target="_blank" rel="noopener noreferrer external" href="'.$url.'">'.$title.'</a>';
print '</li>';
$url = 'https://partners.dolibarr.org'; $title = $langs->trans("ReferencedPreferredPartners");
print '<li>';
print '<a target="_blank" href="'.$url.'" rel="external">'.$title.'</a>';
print '<a target="_blank" rel="noopener noreferrer external" href="'.$url.'">'.$title.'</a>';
print '</li>';
print '</ul>';

View File

@ -93,7 +93,7 @@ $version = DOL_VERSION;
if (preg_match('/[a-z]+/i', $version)) {
$version = 'develop'; // If version contains text, it is not an official tagged version, so we use the full change log.
}
print ' &nbsp; <a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank">'.$langs->trans("SeeChangeLog").'</a>';
print ' &nbsp; <a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank" rel="noopener noreferrer external">'.$langs->trans("SeeChangeLog").'</a>';
$newversion = '';
if (function_exists('curl_init')) {
@ -120,7 +120,7 @@ if (function_exists('curl_init')) {
// Show version
print $langs->trans("LastStableVersion").' : <b>'.(($version != '0.0') ? $version : $langs->trans("Unknown")).'</b>';
if ($version != '0.0') {
print ' &nbsp; <a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank">'.$langs->trans("SeeChangeLog").'</a>';
print ' &nbsp; <a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank" rel="noopener noreferrer external">'.$langs->trans("SeeChangeLog").'</a>';
}
} else {
print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("UpdateServerOffline").'</b>';

View File

@ -180,7 +180,7 @@ $head = ticketAdminPrepareHead();
print dol_get_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket");
print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> : <a class="wordbreak" href="'.DOL_URL_ROOT.'/public/ticket/index.php" target="_blank" >'.dol_buildpath('/public/ticket/index.php', 2).'</a>';
print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> : <a class="wordbreak" href="'.DOL_URL_ROOT.'/public/ticket/index.php" target="_blank" rel="noopener noreferrer">'.dol_buildpath('/public/ticket/index.php', 2).'</a>';
print dol_get_fiche_end();

View File

@ -98,7 +98,9 @@ if (!empty($ExecTimeLimit)) {
@set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64
error_reporting($err);
}
$MemoryLimit = 0;
/* If value has been forced with a php_admin_value, this has no effect. Example of value: '512M' */
$MemoryLimit = getDolGlobalString('MAIN_MEMORY_LIMIT_ARCHIVE_DATAROOT');
if (!empty($MemoryLimit)) {
@ini_set('memory_limit', $MemoryLimit);
}

View File

@ -116,14 +116,14 @@ print $langs->trans("Upgrade").'<br>';
print '<hr>';
print $langs->trans("ThisIsProcessToFollow").'<br>';
print '<b>'.$langs->trans("StepNb", 1).'</b>: ';
$fullurl = '<a href="'.$urldolibarr.'" target="_blank">'.$urldolibarr.'</a>';
$fullurl = '<a href="'.$urldolibarr.'" target="_blank" rel="noopener noreferrer">'.$urldolibarr.'</a>';
print str_replace('{s}', $fullurl, $langs->trans("DownloadPackageFromWebSite", '{s}')).'<br>';
print '<b>'.$langs->trans("StepNb", 2).'</b>: ';
print str_replace('{s}', $dolibarrroot, $langs->trans("UnpackPackageInDolibarrRoot", '{s}')).'<br>';
print '<b>'.$langs->trans("StepNb", 3).'</b>: ';
print $langs->trans("RemoveLock", $dolibarrdataroot.'/install.lock').'<br>';
print '<b>'.$langs->trans("StepNb", 4).'</b>: ';
$fullurl = '<a href="'.DOL_URL_ROOT.'/install/" target="_blank">'.DOL_URL_ROOT.'/install/</a>';
$fullurl = '<a href="'.DOL_URL_ROOT.'/install/" target="_blank" rel="noopener noreferrer">'.DOL_URL_ROOT.'/install/</a>';
print str_replace('{s}', $fullurl, $langs->trans("CallUpdatePage", '{s}')).'<br>';
print '<b>'.$langs->trans("StepNb", 5).'</b>: ';
print $langs->trans("RestoreLock", $dolibarrdataroot.'/install.lock').'<br>';

View File

@ -268,7 +268,7 @@ if ($mode == 'overwrite') {
print '<div class="justify"><span class="opacitymedium">';
print img_info().' '.$langs->trans("SomeTranslationAreUncomplete");
$urlwikitranslatordoc = 'https://wiki.dolibarr.org/index.php/Translator_documentation';
print ' ('.str_replace('{s1}', '<a href="'.$urlwikitranslatordoc.'" target="_blank">'.$langs->trans("Here").'</a>', $langs->trans("SeeAlso", '{s1}')).')<br>';
print ' ('.str_replace('{s1}', '<a href="'.$urlwikitranslatordoc.'" target="_blank" rel="noopener noreferrer external">'.$langs->trans("Here").'</a>', $langs->trans("SeeAlso", '{s1}')).')<br>';
print $langs->trans("TranslationOverwriteDesc", $langs->transnoentitiesnoconv("Language"), $langs->transnoentitiesnoconv("Key"), $langs->transnoentitiesnoconv("NewTranslationStringToShow"))."\n";
print ' ('.$langs->trans("TranslationOverwriteDesc2").').'."<br>\n";
print '</span></div>';

View File

@ -460,7 +460,7 @@ if ($id) {
if ($valuetoshow != '') {
print '<td class="'.$align.'">';
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
print '<a href="'.$tabhelp[$id][$value].'" target="_blank" rel="noopener noreferrer">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (!empty($tabhelp[$id][$value])) {
if ($value == 'virtualhost') {
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltipvirtual');

View File

@ -123,9 +123,25 @@ $workflowcodes = array(
),
// Automatic classification supplier order
'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION'=>array(
'family'=>'classify_supplier_order',
'position'=>63,
'enabled'=>(!empty($conf->global->MAIN_FEATURES_LEVEL) && (!empty($conf->reception->enabled)) && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_order->enabled))),
'picto'=>'supplier_order',
'warning'=>''
),
'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED'=>array(
'family'=>'classify_supplier_order',
'position'=>64,
'enabled'=>(!empty($conf->global->MAIN_FEATURES_LEVEL) && (!empty($conf->reception->enabled)) && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_order->enabled))),
'picto'=>'supplier_order',
'warning'=>''
),
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER'=>array(
'family'=>'classify_supplier_order',
'position'=>62,
'position'=>65,
'enabled'=>((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)),
'picto'=>'supplier_order',
'warning'=>''
@ -134,7 +150,7 @@ $workflowcodes = array(
// Automatic classification reception
'WORKFLOW_BILL_ON_RECEPTION'=>array(
'family'=>'classify_reception',
'position'=>64,
'position'=>80,
'enabled'=>(!empty($conf->reception->enabled) && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))),
'picto'=>'reception'
),
@ -142,7 +158,7 @@ $workflowcodes = array(
// Automatic classification shipping
'WORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE' => array(
'family' => 'classify_shipping',
'position' => 66,
'position' => 90,
'enabled' => ! empty($conf->expedition->enabled) && ! empty($conf->facture->enabled),
'picto' => 'shipment'
)

View File

@ -152,11 +152,11 @@ print '<br>';
print '<span class="opacitymedium">'.$langs->trans("ApiExporerIs").':</span><br>';
if (dol_is_dir(DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/explorer')) {
$url = DOL_MAIN_URL_ROOT.'/api/index.php/explorer';
print '<div class="urllink soixantepercent">'.img_picto('', 'globe').' <a href="'.$url.'" target="_blank">'.$url."</a></div><br>\n";
print '<div class="urllink soixantepercent">'.img_picto('', 'globe').' <a href="'.$url.'" target="_blank" rel="noopener noreferrer">'.$url."</a></div><br>\n";
print '<div class="opacitymediumxxx"><br><span class="opacitymedium">'.$langs->trans("SwaggerDescriptionFile").':</span><br>';
$urlswagger = DOL_MAIN_URL_ROOT.'/api/index.php/explorer/swagger.json?DOLAPIKEY=youruserapikey';
//$urlswaggerreal = DOL_MAIN_URL_ROOT.'/api/index.php/explorer/swagger.json?DOLAPIKEY='.$user->api_key;
print '<div class="urllink soixantepercent">'.img_picto('', 'globe').' <a href="'.$urlswagger.'" target="_blank">'.$urlswagger."</a></div><br>\n";
print '<div class="urllink soixantepercent">'.img_picto('', 'globe').' <a href="'.$urlswagger.'" target="_blank" rel="noopener noreferrer">'.$urlswagger."</a></div><br>\n";
print '</div>';
} else {
$langs->load("errors");

View File

@ -737,14 +737,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$MAXEVENT = 10;
$morehtmlright = '<a href="'.DOL_URL_ROOT.'/bom/bom_agenda.php?id='.$object->id.'">';
$morehtmlright .= $langs->trans("SeeAll");
$morehtmlright .= '</a>';
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/bom/bom_agenda.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, $object->element, $socid, 1, '', $MAXEVENT, '', $morehtmlright);
$somethingshown = $formactions->showactions($object, $object->element, 0, 1, '', $MAXEVENT, '', $morehtmlcenter);
print '</div></div>';
}

View File

@ -90,7 +90,7 @@ function printDropdownBookmarksList()
$bookmarkList = '<div id="dropdown-bookmarks-list" >';
$i = 0;
while ((empty($conf->global->BOOKMARKS_SHOW_IN_MENU) || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql)) {
$bookmarkList .= '<a class="dropdown-item bookmark-item'.(strpos($obj->url, 'http') === 0 ? ' bookmark-item-external' : '').'" id="bookmark-item-'.$obj->rowid.'" data-id="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank"' : '').' href="'.dol_escape_htmltag($obj->url).'" >';
$bookmarkList .= '<a class="dropdown-item bookmark-item'.(strpos($obj->url, 'http') === 0 ? ' bookmark-item-external' : '').'" id="bookmark-item-'.$obj->rowid.'" data-id="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank" rel="noopener noreferrer"' : '').' href="'.dol_escape_htmltag($obj->url).'" >';
$bookmarkList .= dol_escape_htmltag($obj->title);
$bookmarkList .= '</a>';
$i++;
@ -115,7 +115,7 @@ function printDropdownBookmarksList()
}
$i = 0;
while ((empty($conf->global->BOOKMARKS_SHOW_IN_MENU) || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql)) {
$searchForm .= '<option name="bookmark'.$obj->rowid.'" value="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank"' : '').' rel="'.dol_escape_htmltag($obj->url).'" >';
$searchForm .= '<option name="bookmark'.$obj->rowid.'" value="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank" rel="noopener noreferrer"' : '').' rel="'.dol_escape_htmltag($obj->url).'" >';
$searchForm .= dol_escape_htmltag($obj->title);
$searchForm .= '</option>';
$i++;

View File

@ -248,7 +248,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) {
if ($action == 'edit') {
print '<input class="flat minwidth500 quatrevingtpercent" name="url" value="'.(GETPOSTISSET("url") ? GETPOST("url") : $object->url).'">';
} else {
print '<a href="'.(preg_match('/^http/i', $object->url) ? $object->url : DOL_URL_ROOT.$object->url).'"'.($object->target ? ' target="_blank"' : '').'>';
print '<a href="'.(preg_match('/^http/i', $object->url) ? $object->url : DOL_URL_ROOT.$object->url).'"'.($object->target ? ' target="_blank" rel="noopener noreferrer"' : '').'>';
print img_picto('', 'globe', 'class="paddingright"');
print $object->url;
print '</a>';

View File

@ -194,19 +194,19 @@ if ($object->id) {
if (is_array($listofphoto) && count($listofphoto)) {
print '<br>';
print '<table width="100%" valign="top" align="center">';
print '<table width="100%" valign="top" class="center centpercent">';
foreach ($listofphoto as $key => $obj) {
$nbphoto++;
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) {
print '<tr align=center valign=middle border=1>';
print '<tr class"center valignmiddle" border="1">';
}
if ($nbbyrow) {
print '<td width="'.ceil(100 / $nbbyrow).'%" class="photo">';
}
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$obj['photo']).'" alt="Taille origine" target="_blank">';
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$obj['photo']).'" alt="Original size" target="_blank" rel="noopener noreferrer">';
// Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine
if ($obj['photo_vignette']) {

View File

@ -1247,7 +1247,9 @@ if ($action == 'create') {
if (!empty($projectid)) {
$projectsListId = $projectid;
}
$tid = GETPOSTISSET("projecttaskid") ? GETPOST("projecttaskid", 'int') : (GETPOSTISSET("taskid") ? GETPOST("taskid", 'int') : '');
$formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500', $projectsListId);
print '</td></tr>';
}

View File

@ -185,10 +185,7 @@ if ($resql) {
// Show file name with link to download
$out .= '<a href="'.$documenturl.'?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).($param ? '&'.$param : '').'"';
$mime = dol_mimetype($relativepath, '', 0);
if (preg_match('/text/', $mime)) {
$out .= ' target="_blank"';
}
$out .= ' target="_blank">';
$out .= ' target="_blank" rel="noopener noreferrer">';
$out .= img_mime($filearray["name"], $langs->trans("File").': '.$filearray["name"]);
$out .= $filearray["name"];
$out .= '</a>'."\n";

View File

@ -211,7 +211,7 @@ if (empty($reshook)) {
$substitutionarray['__OTHER5__'] = $other5;
$substitutionarray['__USER_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter)
$substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.urlencode($obj->tag).'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->email).'&mtid='.$obj->rowid.'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
$substitutionarray['__UNSUBSCRIBE__'] = '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->email).'&mtid='.$obj->rowid.'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>';
$substitutionarray['__UNSUBSCRIBE__'] = '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->email).'&mtid='.$obj->rowid.'" target="_blank" rel="noopener noreferrer">'.$langs->trans("MailUnsubcribe").'</a>';
$substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->email).'&mtid='.$obj->rowid;
$onlinepaymentenabled = 0;
@ -248,7 +248,7 @@ if (empty($reshook)) {
}
}
if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
$substitutionarray['__PUBLICLINK_NEWMEMBERFORM__'] = '<a target="_blank" href="'.DOL_MAIN_URL_ROOT.'/public/members/new.php'.((!empty($conf->multicompany->enabled)) ? '?entity='.$conf->entity : '').'">'.$langs->trans('BlankSubscriptionForm'). '</a>';
$substitutionarray['__PUBLICLINK_NEWMEMBERFORM__'] = '<a target="_blank" rel="noopener noreferrer" href="'.DOL_MAIN_URL_ROOT.'/public/members/new.php'.((!empty($conf->multicompany->enabled)) ? '?entity='.$conf->entity : '').'">'.$langs->trans('BlankSubscriptionForm'). '</a>';
}
/* For backward compatibility, deprecated */
if (!empty($conf->paypal->enabled) && !empty($conf->global->PAYPAL_SECURITY_TOKEN)) {

View File

@ -57,12 +57,12 @@ $date_start = GETPOST('date_start', 'alpha');
$date_startDay = GETPOST('date_startday', 'int');
$date_startMonth = GETPOST('date_startmonth', 'int');
$date_startYear = GETPOST('date_startyear', 'int');
$date_start = ($date_startDay ? dol_mktime(0, 0, 0, $date_startMonth, $date_startDay, $date_startYear, 'tzuserrel') : dol_stringtotime($date_start));
$date_start = dol_mktime(0, 0, 0, $date_startMonth, $date_startDay, $date_startYear, 'tzuserrel');
$date_stop = GETPOST('date_stop', 'alpha');
$date_stopDay = GETPOST('date_stopday', 'int');
$date_stopMonth = GETPOST('date_stopmonth', 'int');
$date_stopYear = GETPOST('date_stopyear', 'int');
$date_stop = ($date_stopDay ? dol_mktime(23, 59, 59, $date_stopMonth, $date_stopDay, $date_stopYear, 'tzuserrel') : dol_stringtotime($date_stop));
$date_stop = dol_mktime(23, 59, 59, $date_stopMonth, $date_stopDay, $date_stopYear, 'tzuserrel');
$action = GETPOST('action', 'aZ09');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@ -348,8 +348,8 @@ if (($action == 'searchfiles' || $action == 'dl')) {
$nofile = array();
$nofile['id'] = $objd->id;
$nofile['entity'] = $objd->entity;
$nofile['date'] = $db->idate($objd->date);
$nofile['date_due'] = $db->idate($objd->date_due);
$nofile['date'] = $db->jdate($objd->date);
$nofile['date_due'] = $db->jdate($objd->date_due);
$nofile['paid'] = $objd->paid;
$nofile['amount_ht'] = $objd->total_ht;
$nofile['amount_ttc'] = $objd->total_ttc;
@ -368,8 +368,8 @@ if (($action == 'searchfiles' || $action == 'dl')) {
foreach ($files as $key => $file) {
$file['id'] = $objd->id;
$file['entity'] = $objd->entity;
$file['date'] = $db->idate($objd->date);
$file['date_due'] = $db->idate($objd->date_due);
$file['date'] = $db->jdate($objd->date);
$file['date_due'] = $db->jdate($objd->date_due);
$file['paid'] = $objd->paid;
$file['amount_ht'] = $objd->total_ht;
$file['amount_ttc'] = $objd->total_ttc;
@ -460,7 +460,7 @@ if ($result && $action == "dl" && !$error) {
$log .= ','.$langs->transnoentitiesnoconv("Country");
$log .= ','.$langs->transnoentitiesnoconv("VATIntra");
$log .= ','.$langs->transnoentitiesnoconv("Sens")."\n";
$zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip';
$zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel').'_export.zip';
dol_delete_file($zipname);
@ -608,10 +608,14 @@ if (!empty($date_start) && !empty($date_stop)) {
print '<form name="dl" action="'.$_SERVER["PHP_SELF"].'?action=dl" method="POST">'."\n";
print '<input type="hidden" name="token" value="'.currentToken().'">';
echo dol_print_date($date_start, 'day')." - ".dol_print_date($date_stop, 'day');
echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel');
print '<input type="hidden" name="date_start" value="'.dol_print_date($date_start, 'dayxcard').'" />';
print '<input type="hidden" name="date_stop" value="'.dol_print_date($date_stop, 'dayxcard').'" />';
print '<input type="hidden" name="date_startday" value="'.GETPOST('date_startday', 'int').'" />';
print '<input type="hidden" name="date_startmonth" value="'.GETPOST('date_startmonth', 'int').'" />';
print '<input type="hidden" name="date_startyear" value="'.GETPOST('date_startyear', 'int').'" />';
print '<input type="hidden" name="date_stopday" value="'.GETPOST('date_stopday', 'int').'" />';
print '<input type="hidden" name="date_stopmonth" value="'.GETPOST('date_stopmonth', 'int').'" />';
print '<input type="hidden" name="date_stopyear" value="'.GETPOST('date_stopyear', 'int').'" />';
foreach ($listofchoices as $choice => $val) {
print '<input type="hidden" name="'.$choice.'" value="'.GETPOST($choice).'">';
}
@ -732,7 +736,7 @@ if (!empty($date_start) && !empty($date_stop)) {
print '<td>';
if (!empty($data['files'])) {
foreach ($data['files'] as $id => $filecursor) {
print '<a href='.DOL_URL_ROOT.'/'.$filecursor['link'].' target="_blank">'.($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']).'</a>&nbsp;'.$formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name']).'<br>';
print '<a href='.DOL_URL_ROOT.'/'.$filecursor['link'].' target="_blank" rel="noopener noreferrer">'.($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']).'</a>&nbsp;'.$formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name']).'<br>';
}
}
print "</td>\n";
@ -741,19 +745,19 @@ if (!empty($date_start) && !empty($date_stop)) {
print '<td aling="left">'.$data['paid'].'</td>';
// Total ET
print '<td align="right">'.price($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'])."</td>\n";
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."</td>\n";
// Total IT
print '<td align="right">'.price($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'])."</td>\n";
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."</td>\n";
// Total VAT
print '<td align="right">'.price($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'])."</td>\n";
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."</td>\n";
print '<td class="tdoverflowmax150" title="'.$data['thirdparty_name'].'">'.$data['thirdparty_name']."</td>\n";
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($data['thirdparty_name']).'">'.dol_escape_htmltag($data['thirdparty_name'])."</td>\n";
print '<td class="center">'.$data['thirdparty_code']."</td>\n";
print '<td class="center">'.$data['country_code']."</td>\n";
print '<td align="right">'.$data['vatnum']."</td>\n";
print '<td class="tdoverflowmax150 right" title="'.dol_escape_htmltag($data['vatnum']).'">'.dol_escape_htmltag($data['vatnum'])."</td>\n";
if ($data['sens']) {
$totalET_credit += $data['amount_ht'];

View File

@ -8,7 +8,7 @@
*
* 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 2 of the License, or
* 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,

View File

@ -178,7 +178,6 @@ $object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
/*
* Actions
*/
@ -270,13 +269,15 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
if (!$error) {
$param = 'action=reconcile&contextpage=banktransactionlist&id='.$id.'&search_account='.$id;
$param .= '&search_conciliated='.urlencode($search_conciliated);
if ($page) {
$param .= '&page='.urlencode($page);
}
if ($offset) {
$param .= '&offset='.urlencode($offset);
}
if ($search_conciliated != '' && $search_conciliated != '-1') {
$param .= '&search_conciliated='.urlencode($search_conciliated);
}
if ($search_thirdparty_user) {
$param .= '&search_thirdparty='.urlencode($search_thirdparty_user);
}
@ -419,7 +420,6 @@ $banklinestatic = new AccountLine($db);
$now = dol_now();
// Must be before button action
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
@ -757,7 +757,7 @@ if ($resql) {
// Confirmation delete
if ($action == 'delete') {
$text = $langs->trans('ConfirmDeleteTransaction');
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid"), $langs->trans('DeleteTransaction'), $text, 'confirm_delete', null, '', 1);
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid", 'int'), $langs->trans('DeleteTransaction'), $text, 'confirm_delete', null, '', 1);
}
// Lines of title fields
@ -1200,7 +1200,7 @@ if ($resql) {
$objforbalance = $db->fetch_object($resqlforbalance);
if ($objforbalance) {
// If sort is desc,desc,desc then total of previous date + amount is the balancebefore of the previous line before the line to show
if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc') {
if ($sortfield == 'b.datev,b.dateo,b.rowid' && ($sortorder == 'desc' || $sortorder == 'desc,desc' || $sortorder == 'desc,desc,desc')) {
$balancebefore = $objforbalance->previoustotal + ($sign * $objp->amount);
} else {
// If sort is asc,asc,asc then total of previous date is balance of line before the next line to show
@ -1285,8 +1285,7 @@ if ($resql) {
}
}
if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc') {
if ($sortfield == 'b.datev,b.dateo,b.rowid' && ($sortorder == 'desc' || $sortorder == 'desc,desc' || $sortorder == 'desc,desc,desc')) {
$balance = price2num($balancebefore, 'MT'); // balance = balancebefore of previous line (sort is desc)
$balancebefore = price2num($balancebefore - ($sign * $objp->amount), 'MT');
} else {

View File

@ -7,7 +7,7 @@
*
* 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 2 of the License, or
* 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,

View File

@ -46,7 +46,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("banks", "categories", "companies", "bills", "trips", "donations", "loan"));
$langs->loadLangs(array("banks", "categories", "companies", "bills", "trips", "donations", "loan", "salaries"));
$action = GETPOST('action', 'aZ09');
$id = GETPOST('account', 'int') ? GETPOST('account', 'int') : GETPOST('id', 'int');
@ -481,7 +481,7 @@ if (empty($numref)) {
// Description
print '<td valign="center">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&amp;account='.$object->id.'">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&account='.$object->id.'">';
$reg = array();
preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthese on tente recherche de traduction
if ($reg[1] && $langs->trans($reg[1]) != $reg[1]) {
@ -492,7 +492,7 @@ if (empty($numref)) {
print '</a>';
/*
* Ajout les liens (societe, company...)
* Add links under the label (link to payment, company, user, social contribution...)
*/
$newline = 1;
$links = $object->get_url($objp->rowid);

View File

@ -61,8 +61,8 @@ if ($action == 'add') {
$dateo = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$label = GETPOST('label', 'alpha');
$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
$amountto = price2num(GETPOST('amountto', 'alpha'), 'MT');
$amount = price2num(GETPOST('amount', 'alpha'), 'MT', 2);
$amountto = price2num(GETPOST('amountto', 'alpha'), 'MT', 2);
if (!$label) {
$error++;

View File

@ -128,7 +128,7 @@ if (GETPOST('cancel', 'alpha')) {
if ($action == "reopen") {
$result = $object->setStatut($object::STATUS_DRAFT, null, '', 'CASHFENCE_REOPEN');
if ($result < 0) {
dol_print_error($db, $object->error, $object->error);
setEventMessages($object->error, $object->error, 'errors');
}
$action = 'view';
@ -312,7 +312,7 @@ if ($action == "create" || $action == "start" || $action == 'close') {
} elseif ($syear && $smonth && $sday) {
$sql .= " AND dateo < '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."'";
} else {
dol_print_error('', 'Year not defined');
setEventMessages($langs->trans('YearNotDefined'), null, 'errors');
}
$resql = $db->query($sql);
@ -356,7 +356,7 @@ if ($action == "create" || $action == "start" || $action == 'close') {
} elseif ($syear && $smonth && $sday) {
$sql .= " AND datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $smonth, $sday, $syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $smonth, $sday, $syear))."'";
} else {
dol_print_error('', 'Year not defined');
setEventMessages($langs->trans('YearNotDefined'), null, 'errors');
}
$resql = $db->query($sql);
@ -677,14 +677,14 @@ if (empty($action) || $action == "view" || $action == "close") {
if ($action != 'close') {
print '<div class="tabsAction">';
print '<div class="inline-block divButAction"><a target="_blank" class="butAction" href="report.php?id='.$id.'">'.$langs->trans('PrintTicket').'</a></div>';
print '<div class="inline-block divButAction"><a target="_blank" rel="noopener noreferrer" class="butAction" href="report.php?id='.((int) $id).'">'.$langs->trans('PrintTicket').'</a></div>';
if ($object->status == CashControl::STATUS_DRAFT) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=close&token='.newToken().'&contextpage='.$contextpage.'">'.$langs->trans('Close').'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.((int) $id).'&action=close&token='.newToken().'&contextpage='.$contextpage.'">'.$langs->trans('Close').'</a></div>';
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=confirm_delete&token='.newToken().'">'.$langs->trans('Delete').'</a></div>';
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.((int) $id).'&action=confirm_delete&token='.newToken().'">'.$langs->trans('Delete').'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=reopen&token='.newToken().'">'.$langs->trans('ReOpen').'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.((int) $id).'&action=reopen&token='.newToken().'">'.$langs->trans('ReOpen').'</a></div>';
}
print '</div>';

View File

@ -5405,7 +5405,7 @@ if ($action == 'create') {
if (!empty($conf->takepos->enabled) && $object->module_source == 'takepos') {
$langs->load("cashdesk");
$receipt_url = DOL_URL_ROOT."/takepos/receipt.php";
print '<a target="_blank" class="butAction" href="'.$receipt_url.'?facid='.$object->id.'">'.$langs->trans('POSTicket').'</a>';
print '<a target="_blank" rel="noopener noreferrer" class="butAction" href="'.$receipt_url.'?facid='.((int) $object->id).'">'.$langs->trans('POSTicket').'</a>';
}
// Create payment

View File

@ -1058,7 +1058,7 @@ class Facture extends CommonInvoice
{
global $conf;
// Charge facture source
// Source invoice load
$facture = new Facture($this->db);
// Retrieve all extrafield
@ -2405,7 +2405,7 @@ class Facture extends CommonInvoice
/**
* Tag the invoice as paid completely (if close_code is filled) => this->fk_statut=2, this->paye=1
* or partialy (if close_code filled) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0
* or partially (if close_code filled) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0
*
* @param User $user Object user that modify
* @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple)
@ -2421,7 +2421,7 @@ class Facture extends CommonInvoice
$now = dol_now();
dol_syslog(get_class($this)."::set_paid rowid=".((int) $this->id), LOG_DEBUG);
dol_syslog(get_class($this)."::setPaid rowid=".((int) $this->id), LOG_DEBUG);
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture SET';
$sql .= ' fk_statut='.self::STATUS_CLOSED;
@ -2502,7 +2502,7 @@ class Facture extends CommonInvoice
$sql .= ' fk_user_closing=null';
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::set_unpaid", LOG_DEBUG);
dol_syslog(get_class($this)."::setUnpaid", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
// Call trigger
@ -2728,7 +2728,7 @@ class Facture extends CommonInvoice
$error++;
}
// On verifie si la facture etait une provisoire
// We check if the invoice was provisional
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref))) {
// La verif qu'une remise n'est pas utilisee 2 fois est faite au moment de l'insertion de ligne
}
@ -2737,7 +2737,7 @@ class Facture extends CommonInvoice
// Define third party as a customer
$result = $this->thirdparty->set_as_client();
// Si active on decremente le produit principal et ses composants a la validation de facture
// If active we decrement the main product and its components at invoice validation
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse > 0) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda");
@ -4783,7 +4783,7 @@ class Facture extends CommonInvoice
// TODO : add a flag on invoices to store this conf : INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION
// note : we dont need to test INVOICE_USE_RETAINED_WARRANTY because if $this->retained_warranty is not empty it's because it was set when this conf was active
// note : we don't need to test INVOICE_USE_RETAINED_WARRANTY because if $this->retained_warranty is not empty it's because it was set when this conf was active
$displayWarranty = false;
if (!empty($this->retained_warranty)) {
@ -4982,7 +4982,7 @@ class Facture extends CommonInvoice
$this->db->begin();
//Select all action comm reminder
// Select all action comm reminder
$sql = "SELECT rowid as id FROM ".MAIN_DB_PREFIX."facture as f";
if (!empty($paymentmode) && $paymentmode != 'all') {
$sql .= ", ".MAIN_DB_PREFIX."c_paiement as cp";
@ -5382,7 +5382,7 @@ class FactureLigne extends CommonInvoiceLine
$this->db->begin();
// Insertion dans base de la ligne
// Update line in database
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facturedet';
$sql .= ' (fk_facture, fk_parent_line, label, description, qty,';
$sql .= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
@ -5450,8 +5450,8 @@ class FactureLigne extends CommonInvoiceLine
}
}
// Si fk_remise_except defini, on lie la remise a la facture
// ce qui la flague comme "consommee".
// If fk_remise_except is defined, the discount is linked to the invoice
// which flags it as "consumed".
if ($this->fk_remise_except) {
$discount = new DiscountAbsolute($this->db);
$result = $discount->fetch($this->fk_remise_except);
@ -5740,7 +5740,7 @@ class FactureLigne extends CommonInvoiceLine
$this->total_localtax2 = 0;
}
// Mise a jour ligne en base
// Update line in database
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet SET";
$sql .= " total_ht=".price2num($this->total_ht)."";
$sql .= ",total_tva=".price2num($this->total_tva)."";

View File

@ -802,6 +802,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
dol_print_error($db);
}
$formconfirm = '';
// Save button
if ($action != 'add_paiement') {
@ -840,9 +841,21 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$text .= '<br>'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed");
print '<input type="hidden" name="closepaidinvoices" value="'.GETPOST('closepaidinvoices').'">';
}
print $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$facture->id.'&socid='.$facture->socid.'&type='.$facture->type, $langs->trans('ReceivedCustomersPayments'), $text, 'confirm_paiement', $formquestion, $preselectedchoice);
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$facture->id.'&socid='.$facture->socid.'&type='.$facture->type, $langs->trans('ReceivedCustomersPayments'), $text, 'confirm_paiement', $formquestion, $preselectedchoice);
}
// Call Hook formConfirm
$parameters = array('formConfirm' => $formconfirm);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$formconfirm .= $hookmanager->resPrint;
} elseif ($reshook > 0) {
$formconfirm = $hookmanager->resPrint;
}
// Print form confirm
print $formconfirm;
print "</form>\n";
}
}

View File

@ -231,8 +231,11 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char
$object->fetch($id);
if ($object->id > 0) {
$object->paye = 0;
$object->id = $object->ref = null;
$object->paye = 0;
if (GETPOST('amount', 'alphanohtml')) {
$object->amount = price2num(GETPOST('amount', 'alphanohtml'), 'MT', 2);
}
if (GETPOST('clone_label', 'alphanohtml')) {
$object->label = GETPOST('clone_label', 'alphanohtml');
@ -244,7 +247,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char
$object->periode = dol_time_plus_duree($object->periode, 1, 'm');
$object->date_ech = dol_time_plus_duree($object->date_ech, 1, 'm');
} else {
// Note dateech is often a little bit higher than dateperiod
// Note date_ech is often a little bit higher than dateperiod
$newdateperiod = dol_mktime(0, 0, 0, GETPOST('clone_periodmonth', 'int'), GETPOST('clone_periodday', 'int'), GETPOST('clone_periodyear', 'int'));
$newdateech = dol_mktime(0, 0, 0, GETPOST('clone_date_echmonth', 'int'), GETPOST('clone_date_echday', 'int'), GETPOST('clone_date_echyear', 'int'));
if ($newdateperiod) {
@ -263,7 +266,8 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char
}
}
if ($object->check()) {
$resultcheck = $object->check();
if ($resultcheck) {
$id = $object->create($user);
if ($id > 0) {
$db->commit();
@ -431,9 +435,10 @@ if ($id > 0) {
} else {
$formquestion[] = array('type' => 'date', 'datenow'=>1, 'name' => 'clone_date_ech', 'label' => $langs->trans("Date"), 'value' => -1);
$formquestion[] = array('type' => 'date', 'name' => 'clone_period', 'label' => $langs->trans("PeriodEndDate"), 'value' => -1);
$formquestion[] = array('type' => 'text', 'name' => 'amount', 'label' => $langs->trans("Amount"), 'value' => price($object->amount), 'morecss' => 'width100');
}
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneTax', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 240);
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneTax', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 280);
}

View File

@ -198,11 +198,10 @@ class ChargeSociales extends CommonObject
$newamount = price2num($this->amount, 'MT');
// Validation of parameters
if (!$newamount > 0 || empty($this->date_ech) || empty($this->periode)) {
if (!($newamount > 0) || empty($this->date_ech) || empty($this->periode)) {
return false;
}
return true;
}

View File

@ -27,6 +27,9 @@
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
@ -40,9 +43,14 @@ if (!empty($conf->accounting->enabled)) {
$langs->loadLangs(array('compta', 'banks', 'bills'));
$id = GETPOST("id", 'int');
$action = GETPOST("action", "alpha");
$cancel = GETPOST('cancel');
$confirm = GETPOST('confirm');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST("action", "aZ09");
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
$refund = GETPOST("refund", "int");
if (GETPOSTISSET('auto_create_paiement') || $action === 'add') {
$auto_create_payment = GETPOST("auto_create_paiement", "int");
@ -57,15 +65,42 @@ if (empty($refund)) {
$datev = dol_mktime(12, 0, 0, GETPOST("datevmonth", 'int'), GETPOST("datevday", 'int'), GETPOST("datevyear", 'int'));
$datep = dol_mktime(12, 0, 0, GETPOST("datepmonth", 'int'), GETPOST("datepday", 'int'), GETPOST("datepyear", 'int'));
// Initialize technical objects
$object = new Tva($db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->tax->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('taxvatcard', 'globalcard'));
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Initialize array of search criterias
$search_all = GETPOST("search_all", 'alpha');
$search = array();
foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha')) {
$search[$key] = GETPOST('search_'.$key, 'alpha');
}
}
if (empty($action) && empty($id) && empty($ref)) {
$action = 'view';
}
// Load object
if ($id > 0) {
$object->fetch($id);
}
$permissiontoread = $user->rights->tax->charges->lire;
$permissiontoadd = $user->rights->tax->charges->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->tax->charges->supprimer || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$permissionnote = $user->rights->tax->charges->creer; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->tax->charges->creer; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->tax->multidir_output[isset($object->entity) ? $object->entity : 1].'/vat';
// Security check
$socid = GETPOST('socid', 'int');
if ($user->socid) {
@ -74,10 +109,16 @@ if ($user->socid) {
$result = restrictedArea($user, 'tax', '', 'tva', 'charges');
/**
/*
* Actions
*/
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if ($cancel && !$id) {
header("Location: list.php");
exit;
@ -339,11 +380,12 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char
*/
$form = new Form($db);
$formfile = new FormFile($db);
$formproject = new FormProjets($db);
$title = $langs->trans("VAT")." - ".$langs->trans("Card");
$help_url = '';
llxHeader("", $title, $help_url);
llxHeader('', $title, $help_url);
if ($id) {
@ -729,10 +771,11 @@ if ($id) {
print "</form>";
}
/*
* Action bar
*/
print "<div class=\"tabsAction\">\n";
// Buttons for actions
print '<div class="tabsAction">'."\n";
if ($action != 'edit') {
// Reopen
if ($object->paye && $user->rights->tax->charges->creer) {
@ -770,7 +813,66 @@ if ($id) {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("DisabledBecausePayments"))).'">'.$langs->trans("Delete").'</a></div>';
}
}
print "</div>";
print '</div>'."\n";
// Select mail models is same action as presend
if (GETPOST('modelselected')) {
$action = 'presend';
}
if ($action != 'presend') {
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
$includedocgeneration = 1;
// Documents
if ($includedocgeneration) {
$objref = dol_sanitizeFileName($object->ref);
$relativepath = $objref.'/'.$objref.'.pdf';
$filedir = $conf->tax->dir_output.'/vat/'.$objref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
//$genallowed = $user->rights->tax->charges->lire; // If you can read, you can build the PDF to read content
$genallowed = 0;
$delallowed = $user->rights->tax->charges->creer; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('tax-vat', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
}
// Show links to link elements
//$linktoelem = $form->showLinkToObjectBlock($object, null, array('myobject'));
//$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
print '</div><div class="fichehalfright">';
/*
$MAXEVENT = 10;
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
*/
print '</div></div>';
}
//Select mail models is same action as presend
if (GETPOST('modelselected')) {
$action = 'presend';
}
// Presend form
$modelmail = 'vat';
$defaulttopic = 'InformationMessage';
$diroutput = $conf->tax->dir_output;
$trackid = 'vat'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
}
llxFooter();

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006-2021 Regis Houssin <regis.houssin@inodbox.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
@ -114,15 +114,15 @@ print $object->getCivilityLabel();
print '</td></tr>';
// LDAP DN
print '<tr><td>LDAP '.$langs->trans("LDAPContactDn").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_CONTACT_DN."</td></tr>\n";
print '<tr><td>LDAP '.$langs->trans("LDAPContactDn").'</td><td class="valeur" colspan="3">'.getDolGlobalString('LDAP_CONTACT_DN')."</td></tr>\n";
// LDAP Cle
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_KEY_CONTACTS."</td></tr>\n";
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur" colspan="3">'.getDolGlobalString('LDAP_KEY_CONTACTS')."</td></tr>\n";
// LDAP Server
print '<tr><td>LDAP '.$langs->trans("LDAPPrimaryServer").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_SERVER_HOST."</td></tr>\n";
print '<tr><td>LDAP '.$langs->trans("LDAPSecondaryServer").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_SERVER_HOST_SLAVE."</td></tr>\n";
print '<tr><td>LDAP '.$langs->trans("LDAPServerPort").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_SERVER_PORT."</td></tr>\n";
print '<tr><td>LDAP '.$langs->trans("LDAPPrimaryServer").'</td><td class="valeur" colspan="3">'.getDolGlobalString('LDAP_SERVER_HOST')."</td></tr>\n";
print '<tr><td>LDAP '.$langs->trans("LDAPSecondaryServer").'</td><td class="valeur" colspan="3">'.getDolGlobalString('LDAP_SERVER_HOST_SLAVE')."</td></tr>\n";
print '<tr><td>LDAP '.$langs->trans("LDAPServerPort").'</td><td class="valeur" colspan="3">'.getDolGlobalString('LDAP_SERVER_PORT')."</td></tr>\n";
print '</table>';
@ -136,13 +136,13 @@ print dol_get_fiche_end();
*/
print '<div class="tabsAction">';
if (!empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != 'ldap2dolibarr') {
if (!empty($conf->global->LDAP_CONTACT_ACTIVE) && getDolGlobalInt('LDAP_CONTACT_ACTIVE') != Ldap::SYNCHRO_LDAP_TO_DOLIBARR) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
}
print "</div>\n";
if (!empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != 'ldap2dolibarr') {
if (!empty($conf->global->LDAP_CONTACT_ACTIVE) && getDolGlobalInt('LDAP_CONTACT_ACTIVE') != Ldap::SYNCHRO_LDAP_TO_DOLIBARR) {
print "<br>\n";
}

View File

@ -75,7 +75,11 @@ $search_phone_pro = GETPOST("search_phone_pro", 'alpha');
$search_phone_mobile = GETPOST("search_phone_mobile", 'alpha');
$search_fax = GETPOST("search_fax", 'alpha');
$search_email = GETPOST("search_email", 'alpha');
$search_no_email = GETPOST("search_no_email", 'int');
if (!empty($conf->mailing->enabled)) {
$search_no_email = GETPOST("search_no_email", 'int');
} else {
$search_no_email = -1;
}
if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {
if ($value['active']) {

View File

@ -140,6 +140,7 @@ if ($action == 'add' && !empty($permissiontoadd)) {
header("Location: ".$urltogo);
exit;
} else {
$error++;
// Creation KO
if (!empty($object->errors)) {
setEventMessages(null, $object->errors, 'errors');
@ -255,6 +256,7 @@ if ($action == 'update' && !empty($permissiontoadd)) {
if ($result > 0) {
$action = 'view';
} else {
$error++;
// Creation KO
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit';
@ -284,6 +286,7 @@ if ($action == "update_extras" && !empty($permissiontoadd)) {
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
$action = 'view';
} else {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit_extras';
}
@ -301,9 +304,11 @@ if ($action == 'confirm_delete' && !empty($permissiontodelete)) {
if ($result > 0) {
// Delete OK
setEventMessages("RecordDeleted", null, 'mesgs');
header("Location: ".$backurlforlist);
exit;
} else {
$error++;
if (!empty($object->errors)) {
setEventMessages(null, $object->errors, 'errors');
} else {
@ -347,6 +352,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && !empty($permissionto
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
} else {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
$action = '';
@ -383,6 +389,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) {
}
}
} else {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
$action = '';
@ -414,6 +421,7 @@ if ($action == 'confirm_close' && $confirm == 'yes' && $permissiontoadd) {
}
}
} else {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
$action = '';
@ -425,6 +433,7 @@ if ($action == 'confirm_setdraft' && $confirm == 'yes' && $permissiontoadd) {
if ($result >= 0) {
// Nothing else done
} else {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
$action = '';
@ -456,6 +465,7 @@ if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) {
}
}
} else {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
$action = '';
@ -481,6 +491,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && !empty($permissiontoadd))
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$newid); // Open record of new object
exit;
} else {
$error++;
setEventMessages($objectutil->error, $objectutil->errors, 'errors');
$action = '';
}

View File

@ -1295,7 +1295,14 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
if ($objectclass == 'Facture' && empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED) && $objecttmp->status != Facture::STATUS_DRAFT) {
$langs->load("errors");
$nbignored++;
$resaction .= '<div class="error">'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction', $objecttmp->ref).'</div><br>';
$TMsg[] = '<div class="error">'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction', $objecttmp->ref).'</div><br>';
continue;
}
if (method_exists($objecttmp, 'is_erasable') && $objecttmp->is_erasable() <= 0) {
$langs->load("errors");
$nbignored++;
$TMsg[] = '<div class="error">'.$langs->trans('ErrorRecordHasChildren').' '.$objecttmp->ref.'</div><br>';
continue;
}

View File

@ -26,6 +26,14 @@
// $arrayofparameters must be set for action 'update'
// $nomessageinupdate can be set to 1
// $nomessageinsetmoduleoptions can be set to 1
// $formSetup may be defined
if ($action == 'update' && !empty($formSetup) && is_object($formSetup)) {
$formSetup->saveConfFromPost();
return;
}
if ($action == 'update' && is_array($arrayofparameters)) {
$db->begin();

View File

@ -91,7 +91,7 @@ if (empty($conf->bookmarks->enabled)) {
$bookmarkList = '<div id="dropdown-bookmarks-list" class="start">';
$i = 0;
while ((empty($conf->global->BOOKMARKS_SHOW_IN_MENU) || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql)) {
$bookmarkList .= '<a class="dropdown-item bookmark-item'.(strpos($obj->url, 'http') === 0 ? ' bookmark-item-external' : '').'" id="bookmark-item-'.$obj->rowid.'" data-id="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank"' : '').' href="'.dol_escape_htmltag($obj->url).'" >';
$bookmarkList .= '<a class="dropdown-item bookmark-item'.(strpos($obj->url, 'http') === 0 ? ' bookmark-item-external' : '').'" id="bookmark-item-'.$obj->rowid.'" data-id="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank" rel="noopener noreferrer"' : '').' href="'.dol_escape_htmltag($obj->url).'" >';
$bookmarkList .= dol_escape_htmltag($obj->title);
$bookmarkList .= '</a>';
$i++;

View File

@ -33,7 +33,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
class box_shipments extends ModeleBoxes
{
public $boxcode = "lastcustomershipments";
public $boximg = "sending";
public $boximg = "dolly";
public $boxlabel = "BoxLastCustomerShipments";
public $depends = array("expedition");

View File

@ -127,7 +127,7 @@ class CMailFile
* @param array $filename_list List of files to attach (full path of filename on file system)
* @param array $mimetype_list List of MIME type of attached files
* @param array $mimefilename_list List of attached file name in message
* @param string $addr_cc Email cc
* @param string $addr_cc Email cc (Example: 'abc@def.com, ghk@lmn.com')
* @param string $addr_bcc Email bcc (Note: This is autocompleted with MAIN_MAIL_AUTOCOPY_TO if defined)
* @param int $deliveryreceipt Ask a delivery receipt
* @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown make autodetection (with fast mode, not reliable)

View File

@ -492,7 +492,7 @@ abstract class CommonDocGenerator
$array_key.'_remain_to_pay'=>price2num($object->total_ttc - $already_payed_all, 'MT')
);
if (method_exists($object, 'getTotalDiscount') && in_array(get_class($object), array('Proposal', 'Commande', 'Facture', 'SupplierProposal', 'CommandeFournisseur', 'FactureFournisseur'))) {
if (method_exists($object, 'getTotalDiscount') && in_array(get_class($object), array('Propal', 'Proposal', 'Commande', 'Facture', 'SupplierProposal', 'CommandeFournisseur', 'FactureFournisseur'))) {
$resarray[$array_key.'_total_discount_ht_locale'] = price($object->getTotalDiscount(), 0, $outputlangs);
$resarray[$array_key.'_total_discount_ht'] = price2num($object->getTotalDiscount());
} else {
@ -516,8 +516,9 @@ abstract class CommonDocGenerator
// Add vat by rates
if (is_array($object->lines) && count($object->lines) > 0) {
$totalUp = 0;
// Set substitution keys for different VAT rates
foreach ($object->lines as $line) {
// $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward compatibility
// $line->tva_tx format depends on database field accuracy, no reliable. This is kept for backward compatibility
if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) {
$resarray[$array_key.'_total_vat_'.$line->tva_tx] = 0;
}
@ -538,7 +539,7 @@ abstract class CommonDocGenerator
// Note that this added fields does not match a field into database in Dolibarr (Dolibarr manage discount on lines not as a global property of object)
$resarray['object_total_up'] = $totalUp;
$resarray['object_total_up_locale'] = price($resarray['object_total_up'], 0, $outputlangs);
if (method_exists($object, 'getTotalDiscount') && in_array(get_class($object), array('Proposal', 'Commande', 'Facture', 'SupplierProposal', 'CommandeFournisseur', 'FactureFournisseur'))) {
if (method_exists($object, 'getTotalDiscount') && in_array(get_class($object), array('Propal', 'Proposal', 'Commande', 'Facture', 'SupplierProposal', 'CommandeFournisseur', 'FactureFournisseur'))) {
$totalDiscount = $object->getTotalDiscount();
} else {
$totalDiscount = 0;

View File

@ -7817,7 +7817,7 @@ abstract class CommonObject
if ($display_type == 'card') {
$out .= '<tr '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="valuefieldcreate '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >';
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER) && ($action == 'view' || $action == 'editline')) {
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER) && ($action == 'view' || $action == 'valid' || $action == 'editline')) {
$out .= '<td></td>';
}
$out .= '<td class="wordbreak';
@ -8197,7 +8197,7 @@ abstract class CommonObject
if ($urladvanced) {
$return .= '<a href="'.$urladvanced.'">';
} else {
$return .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" class="aphoto" target="_blank">';
$return .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" class="aphoto" target="_blank" rel="noopener noreferrer">';
}
}
@ -8730,7 +8730,11 @@ abstract class CommonObject
$res = $this->db->query($sql);
if ($res === false) {
$error++;
$this->errors[] = $this->db->lasterror();
if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$this->errors[] = "ErrorRefAlreadyExists";
} else {
$this->errors[] = $this->db->lasterror();
}
}
}

View File

@ -110,10 +110,13 @@ class Conf
// Common objects that are not modules
$this->mycompany = new stdClass();
$this->admin = new stdClass();
$this->browser = new stdClass();
$this->medias = new stdClass();
$this->global = new stdClass();
// Common objects that are not modules and set by the main and not into the this->setValues()
$this->browser = new stdClass();
// Common arrays
$this->cache = array();
$this->modules = array();
$this->modules_parts = array(
@ -152,7 +155,6 @@ class Conf
$this->facture = new stdClass();
$this->contrat = new stdClass();
$this->user = new stdClass();
$this->usergroup = new stdClass();
$this->adherent = new stdClass();
$this->bank = new stdClass();
$this->notification = new stdClass();
@ -161,6 +163,23 @@ class Conf
$this->productbatch = new stdClass();
}
/**
* Load setup values into conf object (read llx_const) for a specified entity
* Note that this->db->xxx, this->file->xxx and this->multicompany have been already loaded when setValues is called.
*
* @param int $entity Entity to get
* @return int < 0 if KO, >= 0 if OK
*/
public function setEntityValues($entity)
{
if ($this->entity != $entity) {
// If we ask to reload setup for a new entity
$this->entity = $entity;
return $this->setValues($this->db);
}
return 0;
}
/**
* Load setup values into conf object (read llx_const)
@ -173,6 +192,67 @@ class Conf
{
dol_syslog(get_class($this)."::setValues");
// Unset all old modules values
if (!empty($this->modules)) {
foreach ($this->modules as $m) {
if (isset($this->$m)) unset($this->$m);
}
}
// Common objects that are not modules
$this->mycompany = new stdClass();
$this->admin = new stdClass();
$this->medias = new stdClass();
$this->global = new stdClass();
// Common objects that are not modules and set by the main and not into the this->setValues()
//$this->browser = new stdClass(); // This is set by main and not into this setValues(), so we keep it intact.
// First level object
// TODO Remove this part.
$this->syslog = new stdClass();
$this->expedition_bon = new stdClass();
$this->delivery_note = new stdClass();
$this->fournisseur = new stdClass();
$this->product = new stdClass();
$this->service = new stdClass();
$this->contrat = new stdClass();
$this->actions = new stdClass();
$this->agenda = new stdClass();
$this->commande = new stdClass();
$this->propal = new stdClass();
$this->facture = new stdClass();
$this->contrat = new stdClass();
$this->user = new stdClass();
$this->adherent = new stdClass();
$this->bank = new stdClass();
$this->notification = new stdClass();
$this->mailing = new stdClass();
$this->expensereport = new stdClass();
$this->productbatch = new stdClass();
// Common arrays
$this->cache = array();
$this->modules = array();;
$this->modules_parts = array(
'css' => array(),
'js' => array(),
'tabs' => array(),
'triggers' => array(),
'login' => array(),
'substitutions' => array(),
'menus' => array(),
'theme' => array(),
'sms' => array(),
'tpl' => array(),
'barcode' => array(),
'models' => array(),
'societe' => array(),
'hooks' => array(),
'dir' => array(),
'syslog' => array(),
);
if (!is_null($db) && is_object($db)) {
// Define all global constants into $this->global->key=value
$sql = "SELECT ".$db->decrypt('name')." as name,";
@ -401,10 +481,6 @@ class Conf
$this->user->dir_output = $rootforuser."/users";
$this->user->dir_temp = $rootfortemp."/users/temp";
// For usergroup storage
$this->usergroup->dir_output = $rootforuser."/usergroups";
$this->usergroup->dir_temp = $rootfortemp."/usergroups/temp";
// For proposal storage
$this->propal->multidir_output = array($this->entity => $rootfordata."/propale");
$this->propal->multidir_temp = array($this->entity => $rootfortemp."/propale/temp");
@ -692,6 +768,11 @@ class Conf
$this->global->MAIN_SHOW_STATE_CODE = 1;
}
// By default, we show state code in combo list
if (!isset($this->global->MULTICURRENCY_USE_ORIGIN_TX)) {
$this->global->MULTICURRENCY_USE_ORIGIN_TX = 1;
}
// Use a SCA ready workflow with Stripe module (STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION by default if nothing defined)
if (!isset($this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) && empty($this->global->STRIPE_USE_NEW_CHECKOUT)) {
$this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 1;
@ -775,8 +856,8 @@ class Conf
$this->contrat->services->expires->warning_delay = (isset($this->global->MAIN_DELAY_RUNNING_SERVICES) ? $this->global->MAIN_DELAY_RUNNING_SERVICES : 0) * 86400;
}
if (isset($this->commande)) {
$this->bank->rappro = new stdClass();
$this->bank->cheque = new stdClass();
$this->bank->rappro = new stdClass();
$this->bank->cheque = new stdClass();
$this->bank->rappro->warning_delay = (isset($this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE) ? $this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE : 0) * 86400;
$this->bank->cheque->warning_delay = (isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT) ? $this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT : 0) * 86400;
}
@ -845,6 +926,23 @@ class Conf
}
}
// For backward compatibility
if (!empty($this->global->LDAP_SYNCHRO_ACTIVE)) {
if ($this->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
$this->global->LDAP_SYNCHRO_ACTIVE = 1;
} elseif ($this->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') {
$this->global->LDAP_SYNCHRO_ACTIVE = 2;
}
}
// For backward compatibility
if (!empty($this->global->LDAP_MEMBER_ACTIVE) && $this->global->LDAP_MEMBER_ACTIVE == 'ldap2dolibarr') {
$this->global->LDAP_MEMBER_ACTIVE = 2;
}
// For backward compatibility
if (!empty($this->global->LDAP_MEMBER_TYPE_ACTIVE) && $this->global->LDAP_MEMBER_TYPE_ACTIVE == 'ldap2dolibarr') {
$this->global->LDAP_MEMBER_TYPE_ACTIVE = 2;
}
if (!empty($this->global->MAIN_TZUSERINPUTKEY)) {
$this->tzuserinputkey = $this->global->MAIN_TZUSERINPUTKEY; // 'tzserver' or 'tzuserrel'
}

View File

@ -230,7 +230,8 @@ class HookManager
'setContentSecurityPolicy',
'setHtmlTitle',
'completeTabsHead',
'formDolBanner'
'formDolBanner',
'displayMarginInfos',
)
)) {
$hooktype = 'addreplace';

View File

@ -1926,7 +1926,7 @@ class Form
$sql .= " WHERE u.entity IS NOT NULL";
}
} else {
if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug";
$sql .= " ON ug.fk_user = u.rowid";
$sql .= " WHERE ug.entity = ".$conf->entity;
@ -4905,8 +4905,9 @@ class Form
$formconfirm .= ($question ? '<div class="confirmmessage">'.img_help('', '').' '.$question.'</div>' : '');
$formconfirm .= '</div>'."\n";
$formconfirm .= "\n<!-- begin ajax formconfirm page=".$page." -->\n";
$formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n";
$formconfirm .= '<script type="text/javascript">'."\n";
$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n";
$formconfirm .= 'jQuery(document).ready(function() {
$(function() {
$( "#'.$dialogconfirm.'" ).dialog(

View File

@ -887,7 +887,7 @@ class FormFile
$mime = dol_mimetype($relativepath, '', 0);
if (preg_match('/text/', $mime)) {
$out .= ' target="_blank"';
$out .= ' target="_blank" rel="noopener noreferrer"';
}
$out .= '>';
$out .= img_mime($file["name"], $langs->trans("File").': '.$file["name"]);
@ -976,7 +976,7 @@ class FormFile
foreach ($link_list as $file) {
$out .= '<tr class="oddeven">';
$out .= '<td colspan="'.$colspan.'" class="maxwidhtonsmartphone">';
$out .= '<a data-ajax="false" href="'.$file->url.'" target="_blank">';
$out .= '<a data-ajax="false" href="'.$file->url.'" target="_blank" rel="noopener noreferrer">';
$out .= $file->label;
$out .= '</a>';
$out .= '</td>';
@ -1106,7 +1106,7 @@ class FormFile
$tmpout .= '<li class="nowrap"><a class="pictopreview nowrap" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&amp;entity='.$entity.'&amp;file='.urlencode($relativepath).'"';
$mime = dol_mimetype($relativepath, '', 0);
if (preg_match('/text/', $mime)) {
$tmpout .= ' target="_blank"';
$tmpout .= ' target="_blank" rel="noopener noreferrer"';
}
$tmpout .= '>';
$tmpout .= img_mime($relativepath, $file["name"]);
@ -1410,7 +1410,7 @@ class FormFile
$urlforhref = getAdvancedPreviewUrl($modulepart, $relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']), 1, '&entity='.(!empty($object->entity) ? $object->entity : $conf->entity));
if (empty($urlforhref)) {
$urlforhref = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity) ? $object->entity : $conf->entity).'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']));
print '<a href="'.$urlforhref.'" class="aphoto" target="_blank">';
print '<a href="'.$urlforhref.'" class="aphoto" target="_blank" rel="noopener noreferrer">';
} else {
print '<a href="'.$urlforhref['url'].'" class="'.$urlforhref['css'].'" target="'.$urlforhref['target'].'" mime="'.$urlforhref['mime'].'">';
}
@ -2091,7 +2091,7 @@ class FormFile
} else {
print '<td>';
print img_picto('', 'globe').' ';
print '<a data-ajax="false" href="'.$link->url.'" target="_blank">';
print '<a data-ajax="false" href="'.$link->url.'" target="_blank" rel="noopener noreferrer">';
print dol_escape_htmltag($link->label);
print '</a>';
print '</td>'."\n";

View File

@ -0,0 +1,201 @@
<?php
/* Copyright (C) 2021 Regis Houssin <regis.houssin@inodbox.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.formldap.class.php
* \ingroup core
* \brief File of class with ldap html predefined components
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
/**
* Class to manage generation of HTML components for ldap module
*/
class FormLdap
{
/**
* @var DoliDB Database handler.
*/
public $db;
/**
* @var string Error code (or message)
*/
public $error = '';
/**
* @var string[] Array of error strings
*/
public $errors = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
global $langs, $form;
if (!is_object($form)) {
$form = new Form($this->db);
}
$langs->loadLangs(array("admin", "ldap"));
$this->db = $db;
}
/**
* Return list of types of hash
*
* @param string $selected Preselected type
* @param string $htmlname Name of field in form
* @param int $showempty Add an empty field
* @return string HTML select string
*/
public function selectLdapPasswordHashType($selected = 'md5', $htmlname = 'ldaphashtype', $showempty = 0)
{
global $form;
if (empty($selected)) {
$selected = 'md5';
}
if (empty($htmlname)) {
$htmlname = 'ldaphashtype';
}
$arraylist = array(
//"pbkdf2sha256" => "PBKDF2_SHA256",
"ssha512" => "SSHA-512",
"ssha384" => "SSHA-384",
"ssha256" => "SSHA-256",
"ssha" => "SSHA",
"sha512" => "SHA-512",
"sha384" => "SHA-384",
"sha256" => "SHA-256",
"sha" => "SHA",
"md5" => "MD5",
"smd5" => "SMD5",
//"cryptmd5" => "CRYPT-MD5",
//"cryptsha512" => "CRYPT-SHA512",
//"cryptsha384" => "CRYPT-SHA384",
//"cryptsha256" => "CRYPT-SHA256",
"crypt" => "CRYPT",
"clear" => "CLEAR"
);
return $form->selectarray($htmlname, $arraylist, $selected, $showempty);
}
/**
* Return list of type of synchronization
*
* @param int $selected Preselected type
* @param string $htmlname Name of field in form
* @param array $exclude Exclude values from the list
* @param int $scriptonly Add warning if synchro only work with a script (0 = disable, 1 = Dolibarr2ldap, 2 = ldap2dolibarr, 3 = all)
* @param int $showempty Add an empty field
* @return string HTML select string
*/
public function selectLdapDnSynchroActive($selected = 0, $htmlname = 'activesynchro', $exclude = array(), $scriptonly = 0, $showempty = 0)
{
global $langs, $form;
if (empty($selected)) {
$selected = Ldap::SYNCHRO_NONE;
}
if (empty($htmlname)) {
$htmlname = 'activesynchro';
}
$dolibarr2ldaplabel = $langs->trans("DolibarrToLDAP") . (($scriptonly == 1 || $scriptonly == 3) ? " (".$langs->trans("SupportedForLDAPExportScriptOnly").")" : "");
$ldap2dolibarrlabel = $langs->trans("LDAPToDolibarr") . (($scriptonly == 2 || $scriptonly == 3) ? " (".$langs->trans("SupportedForLDAPImportScriptOnly").")" : "");
$arraylist = array(
Ldap::SYNCHRO_NONE => $langs->trans("No"),
Ldap::SYNCHRO_DOLIBARR_TO_LDAP => $dolibarr2ldaplabel,
Ldap::SYNCHRO_LDAP_TO_DOLIBARR => $ldap2dolibarrlabel
);
if (is_array($exclude) && !empty($exclude)) {
foreach ($exclude as $value) {
if (array_key_exists($value, $arraylist)) {
unset($arraylist[$value]);
}
}
}
return $form->selectarray($htmlname, $arraylist, $selected, $showempty);
}
/**
* Return list of ldap server types
*
* @param string $selected Preselected type
* @param string $htmlname Name of field in form
* @param int $showempty Add an empty field
* @return string HTML select string
*/
public function selectLdapServerType($selected = 'openldap', $htmlname = 'type', $showempty = 0)
{
global $form;
if (empty($selected)) {
$selected = 'openldap';
}
if (empty($htmlname)) {
$htmlname = 'type';
}
$arraylist = array(
'activedirectory' => 'Active Directory',
'openldap' => 'OpenLdap',
'egroupware' => 'Egroupware'
);
return $form->selectarray($htmlname, $arraylist, $selected, $showempty);
}
/**
* Return list of ldap server protocol version
*
* @param string $selected Preselected type
* @param string $htmlname Name of field in form
* @param int $showempty Add an empty field
* @return string HTML select string
*/
public function selectLdapServerProtocolVersion($selected = '3', $htmlname = 'ldapprotocolversion', $showempty = 0)
{
global $form;
if (empty($selected)) {
$selected = '3';
}
if (empty($htmlname)) {
$htmlname = 'ldapprotocolversion';
}
$arraylist = array(
'3' => 'Version 3',
'2' => 'Version 2'
);
return $form->selectarray($htmlname, $arraylist, $selected, $showempty);
}
}

View File

@ -201,7 +201,7 @@ class FormMargin
*/
public function displayMarginInfos($object, $force_price = false)
{
global $langs, $conf, $user;
global $langs, $conf, $user, $hookmanager;
if (!empty($user->socid)) {
return;
@ -213,88 +213,97 @@ class FormMargin
$marginInfo = $this->getMarginInfosArray($object, $force_price);
if (!empty($conf->global->MARGIN_ADD_SHOWHIDE_BUTTON)) { // TODO Warning this feature rely on an external js file that may be removed. Using native js function document.cookie should be better
print $langs->trans('ShowMarginInfos').' : ';
$hidemargininfos = preg_replace('/[^a-zA-Z0-9_\-]/', '', $_COOKIE['DOLUSER_MARGININFO_HIDE_SHOW']); // Clean cookie
print '<span id="showMarginInfos" class="linkobject '.(!empty($hidemargininfos) ? '' : 'hideobject').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</span>';
print '<span id="hideMarginInfos" class="linkobject '.(!empty($hidemargininfos) ? 'hideobject' : '').'">'.img_picto($langs->trans("Enabled"), 'switch_on').'</span>';
$parameters=array('marginInfo'=>$marginInfo);
$reshook = $hookmanager->executeHooks('displayMarginInfos', $parameters, $object, $action);
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
} elseif (empty($reshook)) {
if (!empty($conf->global->MARGIN_ADD_SHOWHIDE_BUTTON)) { // TODO Warning this feature rely on an external js file that may be removed. Using native js function document.cookie should be better
print $langs->trans('ShowMarginInfos') . ' : ';
$hidemargininfos = preg_replace('/[^a-zA-Z0-9_\-]/', '', $_COOKIE['DOLUSER_MARGININFO_HIDE_SHOW']); // Clean cookie
print '<span id="showMarginInfos" class="linkobject ' . (!empty($hidemargininfos) ? '' : 'hideobject') . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</span>';
print '<span id="hideMarginInfos" class="linkobject ' . (!empty($hidemargininfos) ? 'hideobject' : '') . '">' . img_picto($langs->trans("Enabled"), 'switch_on') . '</span>';
print '<script>$(document).ready(function() {
$("span#showMarginInfos").click(function() { $.getScript( "'.dol_buildpath('/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js', 1).'", function( data, textStatus, jqxhr ) { $.cookie("DOLUSER_MARGININFO_HIDE_SHOW", 0); $(".margininfos").show(); $("span#showMarginInfos").addClass("hideobject"); $("span#hideMarginInfos").removeClass("hideobject");})});
$("span#hideMarginInfos").click(function() { $.getScript( "'.dol_buildpath('/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js', 1).'", function( data, textStatus, jqxhr ) { $.cookie("DOLUSER_MARGININFO_HIDE_SHOW", 1); $(".margininfos").hide(); $("span#hideMarginInfos").addClass("hideobject"); $("span#showMarginInfos").removeClass("hideobject");})});
print '<script>$(document).ready(function() {
$("span#showMarginInfos").click(function() { $.getScript( "' . dol_buildpath('/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js', 1) . '", function( data, textStatus, jqxhr ) { $.cookie("DOLUSER_MARGININFO_HIDE_SHOW", 0); $(".margininfos").show(); $("span#showMarginInfos").addClass("hideobject"); $("span#hideMarginInfos").removeClass("hideobject");})});
$("span#hideMarginInfos").click(function() { $.getScript( "' . dol_buildpath('/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js', 1) . '", function( data, textStatus, jqxhr ) { $.cookie("DOLUSER_MARGININFO_HIDE_SHOW", 1); $(".margininfos").hide(); $("span#hideMarginInfos").addClass("hideobject"); $("span#showMarginInfos").removeClass("hideobject");})});
});</script>';
if (!empty($hidemargininfos)) {
print '<script>$(document).ready(function() {$(".margininfos").hide();});</script>';
if (!empty($hidemargininfos)) {
print '<script>$(document).ready(function() {$(".margininfos").hide();});</script>';
}
}
}
print '<div class="div-table-responsive-no-min">';
print '<!-- Margin table -->'."\n";
print '<div class="div-table-responsive-no-min">';
print '<!-- Margin table -->' . "\n";
print '<table class="noborder margintable centpercent">';
print '<tr class="liste_titre">';
print '<td class="liste_titre">'.$langs->trans('Margins').'</td>';
print '<td class="liste_titre right">'.$langs->trans('SellingPrice').'</td>';
if ($conf->global->MARGIN_TYPE == "1") {
print '<td class="liste_titre right">'.$langs->trans('BuyingPrice').'</td>';
} else {
print '<td class="liste_titre right">'.$langs->trans('CostPrice').'</td>';
}
print '<td class="liste_titre right">'.$langs->trans('Margin').'</td>';
if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
print '<td class="liste_titre right">'.$langs->trans('MarginRate').'</td>';
}
if (!empty($conf->global->DISPLAY_MARK_RATES)) {
print '<td class="liste_titre right">'.$langs->trans('MarkRate').'</td>';
}
print '</tr>';
if (!empty($conf->product->enabled)) {
//if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) {
print '<tr class="oddeven">';
print '<td>'.$langs->trans('MarginOnProducts').'</td>';
print '<td class="right">'.price($marginInfo['pv_products']).'</td>';
print '<td class="right">'.price($marginInfo['pa_products']).'</td>';
print '<td class="right">'.price($marginInfo['margin_on_products']).'</td>';
print '<table class="noborder margintable centpercent">';
print '<tr class="liste_titre">';
print '<td class="liste_titre">' . $langs->trans('Margins') . '</td>';
print '<td class="liste_titre right">' . $langs->trans('SellingPrice') . '</td>';
if ($conf->global->MARGIN_TYPE == "1") {
print '<td class="liste_titre right">' . $langs->trans('BuyingPrice') . '</td>';
} else {
print '<td class="liste_titre right">' . $langs->trans('CostPrice') . '</td>';
}
print '<td class="liste_titre right">' . $langs->trans('Margin') . '</td>';
if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
print '<td class="right">'.(($marginInfo['margin_rate_products'] == '') ? '' : price($marginInfo['margin_rate_products'], null, null, null, null, 2).'%').'</td>';
print '<td class="liste_titre right">' . $langs->trans('MarginRate') . '</td>';
}
if (!empty($conf->global->DISPLAY_MARK_RATES)) {
print '<td class="right">'.(($marginInfo['mark_rate_products'] == '') ? '' : price($marginInfo['mark_rate_products'], null, null, null, null, 2).'%').'</td>';
print '<td class="liste_titre right">' . $langs->trans('MarkRate') . '</td>';
}
print '</tr>';
}
if (!empty($conf->service->enabled)) {
print '<tr class="oddeven">';
print '<td>'.$langs->trans('MarginOnServices').'</td>';
print '<td class="right">'.price($marginInfo['pv_services']).'</td>';
print '<td class="right">'.price($marginInfo['pa_services']).'</td>';
print '<td class="right">'.price($marginInfo['margin_on_services']).'</td>';
if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
print '<td class="right">'.(($marginInfo['margin_rate_services'] == '') ? '' : price($marginInfo['margin_rate_services'], null, null, null, null, 2).'%').'</td>';
if (!empty($conf->product->enabled)) {
//if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) {
print '<tr class="oddeven">';
print '<td>' . $langs->trans('MarginOnProducts') . '</td>';
print '<td class="right">' . price($marginInfo['pv_products']) . '</td>';
print '<td class="right">' . price($marginInfo['pa_products']) . '</td>';
print '<td class="right">' . price($marginInfo['margin_on_products']) . '</td>';
if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
print '<td class="right">' . (($marginInfo['margin_rate_products'] == '') ? '' : price($marginInfo['margin_rate_products'], null, null, null, null, 2) . '%') . '</td>';
}
if (!empty($conf->global->DISPLAY_MARK_RATES)) {
print '<td class="right">' . (($marginInfo['mark_rate_products'] == '') ? '' : price($marginInfo['mark_rate_products'], null, null, null, null, 2) . '%') . '</td>';
}
print '</tr>';
}
if (!empty($conf->global->DISPLAY_MARK_RATES)) {
print '<td class="right">'.(($marginInfo['mark_rate_services'] == '') ? '' : price($marginInfo['mark_rate_services'], null, null, null, null, 2).'%').'</td>';
}
print '</tr>';
}
if (!empty($conf->product->enabled) && !empty($conf->service->enabled)) {
print '<tr class="liste_total">';
print '<td>'.$langs->trans('TotalMargin').'</td>';
print '<td class="right">'.price($marginInfo['pv_total']).'</td>';
print '<td class="right">'.price($marginInfo['pa_total']).'</td>';
print '<td class="right">'.price($marginInfo['total_margin']).'</td>';
if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
print '<td class="right">'.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').'</td>';
if (!empty($conf->service->enabled)) {
print '<tr class="oddeven">';
print '<td>' . $langs->trans('MarginOnServices') . '</td>';
print '<td class="right">' . price($marginInfo['pv_services']) . '</td>';
print '<td class="right">' . price($marginInfo['pa_services']) . '</td>';
print '<td class="right">' . price($marginInfo['margin_on_services']) . '</td>';
if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
print '<td class="right">' . (($marginInfo['margin_rate_services'] == '') ? '' : price($marginInfo['margin_rate_services'], null, null, null, null, 2) . '%') . '</td>';
}
if (!empty($conf->global->DISPLAY_MARK_RATES)) {
print '<td class="right">' . (($marginInfo['mark_rate_services'] == '') ? '' : price($marginInfo['mark_rate_services'], null, null, null, null, 2) . '%') . '</td>';
}
print '</tr>';
}
if (!empty($conf->global->DISPLAY_MARK_RATES)) {
print '<td class="right">'.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').'</td>';
if (!empty($conf->product->enabled) && !empty($conf->service->enabled)) {
print '<tr class="liste_total">';
print '<td>' . $langs->trans('TotalMargin') . '</td>';
print '<td class="right">' . price($marginInfo['pv_total']) . '</td>';
print '<td class="right">' . price($marginInfo['pa_total']) . '</td>';
print '<td class="right">' . price($marginInfo['total_margin']) . '</td>';
if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
print '<td class="right">' . (($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2) . '%') . '</td>';
}
if (!empty($conf->global->DISPLAY_MARK_RATES)) {
print '<td class="right">' . (($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2) . '%') . '</td>';
}
print '</tr>';
}
print '</tr>';
print $hookmanager->resPrint;
print '</table>';
print '</div>';
} elseif ($reshook > 0) {
print $hookmanager->resPrint;
}
print '</table>';
print '</div>';
}
}

View File

@ -0,0 +1,926 @@
<?php
/* Copyright (C) 2021 John BOTELLA <john.botella@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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/>.
*/
/**
* This class help you create setup render
*/
class FormSetup
{
/**
* @var DoliDB Database handler.
*/
public $db;
/** @var FormSetupItem[] */
public $items = array();
/**
* @var int
*/
public $setupNotEmpty = 0;
/** @var Translate */
public $langs;
/** @var Form */
public $form;
/** @var int */
protected $maxItemRank;
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param Translate $outputLangs if needed can use another lang
*/
public function __construct($db, $outputLangs = false)
{
global $langs;
$this->db = $db;
$this->form = new Form($this->db);
if ($outputLangs) {
$this->langs = $outputLangs;
} else {
$this->langs = $langs;
}
}
/**
* @param bool $editMode true will display output on edit mod
* @return string
*/
public function generateOutput($editMode = false)
{
global $hookmanager, $action;
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
$parameters = array(
'editMode' => $editMode
);
$reshook = $hookmanager->executeHooks('formSetupBeforeGenerateOutput', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if ($reshook > 0) {
return $hookmanager->resPrint;
} else {
$out = '<input type="hidden" name="token" value="' . newToken() . '">';
if ($editMode) {
$out .= '<input type="hidden" name="action" value="update">';
}
$out .= '<table class="noborder centpercent">';
$out .= '<thead>';
$out .= '<tr class="liste_titre">';
$out .= ' <td class="titlefield">' . $this->langs->trans("Parameter") . '</td>';
$out .= ' <td>' . $this->langs->trans("Value") . '</td>';
$out .= '</tr>';
$out .= '</thead>';
// Sort items before render
$this->sortingItems();
$out .= '<tbody>';
foreach ($this->items as $item) {
$out .= $this->generateLineOutput($item, $editMode);
}
$out .= '</tbody>';
$out .= '</table>';
return $out;
}
}
/**
* @param bool $noMessageInUpdate display event message on errors and success
* @return void|null
*/
public function saveConfFromPost($noMessageInUpdate = false)
{
if (empty($this->items)) {
return null;
}
$this->db->begin();
$error = 0;
foreach ($this->items as $item) {
$res = $item->setValueFromPost();
if ($res > 0) {
$item->saveConfValue();
} elseif ($res < 0) {
$error++;
break;
}
}
if (!$error) {
$this->db->commit();
if (empty($noMessageInUpdate)) {
setEventMessages($this->langs->trans("SetupSaved"), null);
}
} else {
$this->db->rollback();
if (empty($noMessageInUpdate)) {
setEventMessages($this->langs->trans("SetupNotSaved"), null, 'errors');
}
}
}
/**
* @param FormSetupItem $item the setup item
* @param bool $editMode Display as edit mod
* @return string the html output for an setup item
*/
public function generateLineOutput($item, $editMode = false)
{
$out = '';
if ($item->enabled==1) {
$this->setupNotEmpty++;
$out.= '<tr class="oddeven">';
$out.= '<td class="col-setup-title">';
$out.= '<span id="helplink'.$item->confKey.'" class="spanforparamtooltip">';
$out.= $this->form->textwithpicto($item->getNameText(), $item->getHelpText(), 1, 'info', '', 0, 3, 'tootips'.$item->confKey);
$out.= '</span>';
$out.= '</td>';
$out.= '<td>';
if ($editMode) {
$out.= $item->generateInputField();
} else {
$out.= $item->generateOutputField();
}
if (!empty($item->errors)) {
// TODO : move set event message in a methode to be called by cards not by this class
setEventMessages(null, $item->errors, 'errors');
}
$out.= '</td>';
$out.= '</tr>';
}
return $out;
}
/**
* @param array $params an array of arrays of params from old modulBuilder params
* @deprecated was used to test module builder convertion to this form usage
* @return null
*/
public function addItemsFromParamsArray($params)
{
if (!array($params)) { return false; }
foreach ($params as $confKey => $param) {
$this->addItemFromParams($confKey, $param); // todo manage error
}
}
/**
* From old
* @param string $confKey the conf name to store
* @param array $params an array of params from old modulBuilder params
* @deprecated was used to test module builder convertion to this form usage
* @return bool
*/
public function addItemFromParams($confKey, $params)
{
if (empty($confKey) || empty($params['type'])) { return false; }
/*
* Exemple from old module builder setup page
* // 'MYMODULE_MYPARAM1'=>array('type'=>'string', 'css'=>'minwidth500' ,'enabled'=>1),
// 'MYMODULE_MYPARAM2'=>array('type'=>'textarea','enabled'=>1),
//'MYMODULE_MYPARAM3'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
//'MYMODULE_MYPARAM4'=>array('type'=>'emailtemplate:thirdparty', 'enabled'=>1),
//'MYMODULE_MYPARAM5'=>array('type'=>'yesno', 'enabled'=>1),
//'MYMODULE_MYPARAM5'=>array('type'=>'thirdparty_type', 'enabled'=>1),
//'MYMODULE_MYPARAM6'=>array('type'=>'securekey', 'enabled'=>1),
//'MYMODULE_MYPARAM7'=>array('type'=>'product', 'enabled'=>1),
*/
$item = new FormSetupItem($confKey);
$item->setTypeFromTypeString($params['type']);
if (!empty($params['enabled'])) {
$item->enabled = $params['enabled'];
}
if (!empty($params['css'])) {
$item->cssClass = $params['css'];
}
$this->items[$item->confKey] = $item;
return true;
}
/**
* used to export param array for /core/actions_setmoduleoptions.inc.php template
* @return array $arrayofparameters for /core/actions_setmoduleoptions.inc.php
* @deprecated yes this method came deprecated because it exists only for manage setup convertion
*/
public function exportItemsAsParamsArray()
{
$arrayofparameters = array();
foreach ($this->items as $key => $item) {
$arrayofparameters[$item->confKey] = array(
'type' => $item->getType(),
'enabled' => $item->enabled
);
}
return $arrayofparameters;
}
/**
* Reload for each item default conf
* note: this will override custom configuration
* @return bool
*/
public function reloadConfs()
{
if (!array($this->items)) { return false; }
foreach ($this->items as $item) {
$item->reloadValueFromConf();
}
return true;
}
/**
* Create a new item
* the tagret is useful with hooks : that allow externals modules to add setup items on good place
* @param $confKey the conf key used in database
* @param string $targetItemKey target item used to place the new item beside
* @param bool $insertAfterTarget insert before or after target item ?
* @return FormSetupItem the new setup item created
*/
public function newItem($confKey, $targetItemKey = false, $insertAfterTarget = false)
{
$item = new FormSetupItem($confKey);
// set item rank if not defined as last item
if (empty($item->rank)) {
$item->rank = $this->getCurentItemMaxRank() + 1;
$this->setItemMaxRank($item->rank); // set new max rank if needed
}
// try to get rank from target column, this will override item->rank
if (!empty($targetItemKey)) {
if (isset($this->items[$targetItemKey])) {
$targetItem = $this->items[$targetItemKey];
$item->rank = $targetItem->rank; // $targetItem->rank will be increase after
if ($targetItem->rank >= 0 && $insertAfterTarget) {
$item->rank++;
}
}
// calc new rank for each item to make place for new item
foreach ($this->items as $fItem) {
if ($item->rank <= $fItem->rank) {
$fItem->rank = $fItem->rank + 1;
$this->setItemMaxRank($fItem->rank); // set new max rank if needed
}
}
}
$this->items[$item->confKey] = $item;
return $this->items[$item->confKey];
}
/**
* Sort items according to rank
* @return bool
*/
public function sortingItems()
{
// Sorting
return uasort($this->items, array($this, 'itemSort'));
}
/**
* @param bool $cache To use cache or not
* @return int
*/
public function getCurentItemMaxRank($cache = true)
{
if (empty($this->items)) {
return 0;
}
if ($cache && $this->maxItemRank > 0) {
return $this->maxItemRank;
}
$this->maxItemRank = 0;
foreach ($this->items as $item) {
$this->maxItemRank = max($this->maxItemRank, $item->rank);
}
return $this->maxItemRank;
}
/**
* set new max rank if needed
* @param int $rank the item rank
* @return int|void
*/
public function setItemMaxRank($rank)
{
$this->maxItemRank = max($this->maxItemRank, $rank);
}
/**
* get item position rank from item key
*
* @param string $itemKey the item key
* @return int rank on success and -1 on error
*/
public function getLineRank($itemKey)
{
if (!isset($this->items[$itemKey]->rank)) {
return -1;
}
return $this->items[$itemKey]->rank;
}
/**
* uasort callback function to Sort params items
*
* @param FormSetupItem $a formSetup item
* @param FormSetupItem $b formSetup item
* @return int Return compare result
*/
public function itemSort(FormSetupItem $a, FormSetupItem $b)
{
if (empty($a->rank)) {
$a->rank = 0;
}
if (empty($b->rank)) {
$b->rank = 0;
}
if ($a->rank == $b->rank) {
return 0;
}
return ($a->rank < $b->rank) ? -1 : 1;
}
}
/**
* This class help to create item for class formSetup
*/
class FormSetupItem
{
/**
* @var DoliDB Database handler.
*/
public $db;
/** @var Translate */
public $langs;
/** @var int */
public $entity;
/** @var Form */
public $form;
/** @var string $confKey the conf key used in database */
public $confKey;
/** @var string|false $nameText */
public $nameText = false;
/** @var string $helpText */
public $helpText = '';
/** @var string $value */
public $fieldValue;
/** @var bool|string set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too */
public $fieldOverride = false;
/** @var bool|string set this var to override field output */
public $fieldInputOverride = false;
/** @var bool|string set this var to override field output */
public $fieldOutputOverride = false;
/** @var int $rank */
public $rank = 0;
/**
* @var string $errors
*/
public $errors = array();
/**
* TODO each type must have setAs{type} method to help configuration
* And set var as protected when its done configuration must be done by method
* @var string $type 'string', 'textarea', 'category:'.Categorie::TYPE_CUSTOMER', 'emailtemplate', 'thirdparty_type'
*/
protected $type = 'string';
public $enabled = 1;
public $cssClass = '';
/**
* Constructor
*
* @param $confKey the conf key used in database
*/
public function __construct($confKey)
{
global $langs, $db, $conf;
$this->db = $db;
$this->form = new Form($this->db);
$this->langs = $langs;
$this->entity = $conf->entity;
$this->confKey = $confKey;
$this->fieldValue = $conf->global->{$this->confKey};
}
/**
* reload conf value from databases
* @return null
*/
public function reloadValueFromConf()
{
global $conf;
$this->fieldValue = $conf->global->{$this->confKey};
}
/**
* Save const value based on htdocs/core/actions_setmoduleoptions.inc.php
* @return int -1 if KO, 1 if OK
*/
public function saveConfValue()
{
// Modify constant only if key was posted (avoid resetting key to the null value)
if ($this->type != 'title') {
$result = dolibarr_set_const($this->db, $this->confKey, $this->fieldValue, 'chaine', 0, '', $this->entity);
if ($result < 0) {
return -1;
} else {
return 1;
}
}
}
/**
* Save const value based on htdocs/core/actions_setmoduleoptions.inc.php
* @return int -1 if KO, 0 nothing to do , 1 if OK
*/
public function setValueFromPost()
{
// Modify constant only if key was posted (avoid resetting key to the null value)
if ($this->type != 'title') {
if (preg_match('/category:/', $this->type)) {
if (GETPOST($this->confKey, 'int') == '-1') {
$val_const = '';
} else {
$val_const = GETPOST($this->confKey, 'int');
}
} else {
$val_const = GETPOST($this->confKey, 'alpha');
}
// TODO add value check with class validate
$this->fieldValue = $val_const;
return 1;
}
return 0;
}
/**
* Get help text or generate it
* @return int|string
*/
public function getHelpText()
{
if (!empty($this->helpText)) { return $this->helpText; }
return (($this->langs->trans($this->confKey . 'Tooltip') != $this->confKey . 'Tooltip') ? $this->langs->trans($this->confKey . 'Tooltip') : '');
}
/**
* Get field name text or generate it
* @return false|int|string
*/
public function getNameText()
{
if (!empty($this->nameText)) { return $this->nameText; }
return (($this->langs->trans($this->confKey) != $this->confKey) ? $this->langs->trans($this->confKey) : $this->langs->trans('MissingTranslationForConfKey', $this->confKey));
}
/**
* generate input field
* @return bool|string
*/
public function generateInputField()
{
global $conf, $user;
if (!empty($this->fieldOverride)) {
return $this->fieldOverride;
}
if (!empty($this->fieldInputOverride)) {
return $this->fieldInputOverride;
}
$out = '';
if ($this->type == 'title') {
$out.= $this->generateOutputField(); // title have no input
} elseif ($this->type == 'textarea') {
$out.= $this->generateInputFieldTextarea();
} elseif ($this->type== 'html') {
$out.= $this->generateInputFieldHtml();
} elseif ($this->type == 'yesno') {
$out.= $this->form->selectyesno($this->confKey, $this->fieldValue, 1);
} elseif (preg_match('/emailtemplate:/', $this->type)) {
$out.= $this->generateInputFieldEmailTemplate();
} elseif (preg_match('/category:/', $this->type)) {
$out.=$this->generateInputFieldCategories();
} elseif (preg_match('/thirdparty_type/', $this->type)) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$formcompany = new FormCompany($this->db);
$out.= $formcompany->selectProspectCustomerType($this->fieldValue, $this->confKey);
} elseif ($this->type == 'securekey') {
$out.= $this->generateInputFieldSecureKey();
} elseif ($this->type == 'product') {
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
$selected = (empty($this->fieldValue) ? '' : $this->fieldValue);
$out.= $this->form->select_produits($selected, $this->confKey, '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, $this->cssClass, 0, '', null, 1);
}
} else {
$out.= '<input name="'.$this->confKey.'" class="flat '.(empty($this->cssClass) ? 'minwidth200' : $this->cssClass).'" value="'.$this->fieldValue.'">';
}
return $out;
}
/**
* generate input field for textarea
* @return string
*/
public function generateInputFieldTextarea()
{
$out = '<textarea class="flat" name="'.$this->confKey.'" id="'.$this->confKey.'" cols="50" rows="5" wrap="soft">' . "\n";
$out.= dol_htmlentities($this->fieldValue);
$out.= "</textarea>\n";
return $out;
}
/**
* generate input field for html
* @return string
*/
public function generateInputFieldHtml()
{
global $conf;
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor($this->confKey, $this->fieldValue, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%');
return $doleditor->Create(1);
}
/**
* generate input field for categories
* @return string
*/
public function generateInputFieldCategories()
{
global $conf;
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$formother = new FormOther($this->db);
$tmp = explode(':', $this->type);
$out= img_picto('', 'category', 'class="pictofixedwidth"');
$out.= $formother->select_categories($tmp[1], $this->fieldValue, $this->confKey, 0, $this->langs->trans('CustomersProspectsCategoriesShort'));
return $out;
}
/**
* generate input field for email template selector
* @return string
*/
public function generateInputFieldEmailTemplate()
{
global $conf, $user;
$out = '';
if (preg_match('/emailtemplate:/', $this->type)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($this->db);
$tmp = explode(':', $this->type);
$nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, 1); // We set lang=null to get in priority record with no lang
$arrayOfMessageName = array();
if (is_array($formmail->lines_model)) {
foreach ($formmail->lines_model as $modelMail) {
$moreonlabel = '';
if (!empty($arrayOfMessageName[$modelMail->label])) {
$moreonlabel = ' <span class="opacitymedium">(' . $this->langs->trans("SeveralLangugeVariatFound") . ')</span>';
}
// The 'label' is the key that is unique if we exclude the language
$arrayOfMessageName[$modelMail->id] = $this->langs->trans(preg_replace('/\(|\)/', '', $modelMail->label)) . $moreonlabel;
}
}
$out .= $this->form->selectarray($this->confKey, $arrayOfMessageName, $this->fieldValue, 'None', 0, 0, '', 0, 0, 0, '', '', 1);
}
return $out;
}
/**
* generate input field for secure key
* @return string
*/
public function generateInputFieldSecureKey()
{
global $conf;
$out = '<input required="required" type="text" class="flat" id="'.$this->confKey.'" name="'.$this->confKey.'" value="'.(GETPOST($this->confKey, 'alpha') ?GETPOST($this->confKey, 'alpha') : $this->fieldValue).'" size="40">';
if (!empty($conf->use_javascript_ajax)) {
$out.= '&nbsp;'.img_picto($this->langs->trans('Generate'), 'refresh', 'id="generate_token'.$this->confKey.'" class="linkobject"');
}
if (!empty($conf->use_javascript_ajax)) {
$out .= "\n" . '<script type="text/javascript">';
$out .= '$(document).ready(function () {
$("#generate_token' . $this->confKey . '").click(function() {
$.get( "' . DOL_URL_ROOT . '/core/ajax/security.php", {
action: \'getrandompassword\',
generic: true
},
function(token) {
$("#' . $this->confKey . '").val(token);
});
});
});';
$out .= '</script>';
}
return $out;
}
/**
* get the type : used for old module builder setup conf style conversion and tests
* because this two class will quickly evolve it's important to not set or get directly $this->type (will be protected) so this method exist
* to be sure we can manage evolution easily
*
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* set the type from string : used for old module builder setup conf style conversion and tests
* because this two class will quickly evolve it's important to not set directly $this->type (will be protected) so this method exist
* to be sure we can manage evolution easily
* @param string $type possible values based on old module builder setup : 'string', 'textarea', 'category:'.Categorie::TYPE_CUSTOMER', 'emailtemplate', 'thirdparty_type'
* @deprecated yes this setTypeFromTypeString came deprecated because it exists only for manage setup convertion
* @return bool
*/
public function setTypeFromTypeString($type)
{
$this->type = $type;
return true;
}
/**
* Add error
* @param array|string $errors the error text
* @return null
*/
public function setErrors($errors)
{
if (is_array($errors)) {
if (!empty($errors)) {
foreach ($errors as $error) {
$this->setErrors($error);
}
}
} elseif (!empty($errors)) {
$this->errors[] = $errors;
}
}
/**
* @return bool|string Generate the output html for this item
*/
public function generateOutputField()
{
global $conf, $user;
if (!empty($this->fieldOverride)) {
return $this->fieldOverride;
}
if (!empty($this->fieldOutputOverride)) {
return $this->fieldOutputOverride;
}
$out = '';
if ($this->type == 'title') {
// nothing to do
} elseif ($this->type == 'textarea') {
$out.= dol_nl2br($this->fieldValue);
} elseif ($this->type== 'html') {
$out.= $this->fieldValue;
} elseif ($this->type == 'yesno') {
$out.= ajax_constantonoff($this->confKey);
} elseif (preg_match('/emailtemplate:/', $this->type)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($this->db);
$tmp = explode(':', $this->type);
$template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue);
if ($template<0) {
$this->setErrors($formmail->errors);
}
$out.= $this->langs->trans($template->label);
} elseif (preg_match('/category:/', $this->type)) {
$c = new Categorie($this->db);
$result = $c->fetch($this->fieldValue);
if ($result < 0) {
$this->setErrors($c->errors);
}
$ways = $c->print_all_ways(' &gt;&gt; ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
$toprint = array();
foreach ($ways as $way) {
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
}
$out.='<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
} elseif (preg_match('/thirdparty_type/', $this->type)) {
if ($this->fieldValue==2) {
$out.= $this->langs->trans("Prospect");
} elseif ($this->fieldValue==3) {
$out.= $this->langs->trans("ProspectCustomer");
} elseif ($this->fieldValue==1) {
$out.= $this->langs->trans("Customer");
} elseif ($this->fieldValue==0) {
$out.= $this->langs->trans("NorProspectNorCustomer");
}
} elseif ($this->type == 'product') {
$product = new Product($this->db);
$resprod = $product->fetch($this->fieldValue);
if ($resprod > 0) {
$out.= $product->ref;
} elseif ($resprod < 0) {
$this->setErrors($product->errors);
}
} else {
$out.= $this->fieldValue;
}
return $out;
}
/*
* METHODS FOR SETTING DISPLAY TYPE
*/
/**
* Set type of input as string
* @return self
*/
public function setAsString()
{
$this->type = 'string';
return $this;
}
/**
* Set type of input as textarea
* @return self
*/
public function setAsTextarea()
{
$this->type = 'textarea';
return $this;
}
/**
* Set type of input as html editor
* @return self
*/
public function setAsHtml()
{
$this->type = 'html';
return $this;
}
/**
* Set type of input as emailtemplate selector
* @param string $templateType email template type
* @return self
*/
public function setAsEmailTemplate($templateType)
{
$this->type = 'emailtemplate:'.$templateType;
return $this;
}
/**
* Set type of input as thirdparty_type selector
* @return self
*/
public function setAsThirdpartyType()
{
$this->type = 'thirdparty_type';
return $this;
}
/**
* Set type of input as Yes
* @return self
*/
public function setAsYesNo()
{
$this->type = 'yesno';
return $this;
}
/**
* Set type of input as secure key
* @return self
*/
public function setAsSecureKey()
{
$this->type = 'securekey';
return $this;
}
/**
* Set type of input as product
* @return self
*/
public function setAsProduct()
{
$this->type = 'product';
return $this;
}
/**
* Set type of input as a category selector
* TODO add default value
* @param int $catType Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
* @return self
*/
public function setAsCategory($catType)
{
$this->type = 'category:'.$catType;
return $this;
}
/**
* Set type of input as a simple title
* no data to store
* @return self
*/
public function setAsTitle()
{
$this->type = 'title';
return $this;
}
}

View File

@ -122,6 +122,21 @@ class Ldap
*/
public $result;
/**
* No Ldap synchronization
*/
const SYNCHRO_NONE = 0;
/**
* Dolibarr to Ldap synchronization
*/
const SYNCHRO_DOLIBARR_TO_LDAP = 1;
/**
* Ldap to Dolibarr synchronization
*/
const SYNCHRO_LDAP_TO_DOLIBARR = 2;
/**
* Constructor
@ -225,6 +240,7 @@ class Ldap
// For test/debug
//ldap_set_option($this->connection, LDAP_OPT_DEBUG_LEVEL, 7);
//ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, 3);
//ldap_set_option($this->connection, LDAP_OPT_REFERRALS, 0);
$resulttls = ldap_start_tls($this->connection);
if (!$resulttls) {
@ -299,7 +315,6 @@ class Ldap
return $return;
}
/**
* Simply closes the connection set up earlier. Returns true if OK, false if there was an error.
* This method seems a duplicate/alias of unbind().
@ -920,10 +935,10 @@ class Ldap
return -3;
}
$search = ldap_search($this->connection, $dn, $filter);
$search = @ldap_search($this->connection, $dn, $filter);
// Only one entry should ever be returned
$entry = ldap_first_entry($this->connection, $search);
$entry = @ldap_first_entry($this->connection, $search);
if (!$entry) {
$this->ldapErrorCode = -1;

View File

@ -358,10 +358,19 @@ class Utils
dol_syslog("Utils::dumpDatabase execmethod=".$execmethod." command:".$fullcommandcrypted, LOG_INFO);
/* If value has been forced with a php_admin_value, this has no effect. Example of value: '512M' */
$MemoryLimit = getDolGlobalString('MAIN_MEMORY_LIMIT_DUMP');
if (!empty($MemoryLimit)) {
@ini_set('memory_limit', $MemoryLimit);
}
// TODO Replace with executeCLI function
if ($execmethod == 1) {
$output_arr = array();
$retval = null;
exec($fullcommandclear, $output_arr, $retval);
if ($retval != 0) {

View File

@ -77,7 +77,8 @@ abstract class DoliDB implements Database
*/
public function ifsql($test, $resok, $resko)
{
return 'IF('.$test.','.$resok.','.$resko.')';
//return 'IF('.$test.','.$resok.','.$resko.')'; // Not sql standard
return '(CASE WHEN '.$test.' THEN '.$resok.' ELSE '.$resko.' END)';
}
/**
@ -233,7 +234,7 @@ abstract class DoliDB implements Database
* Define sort criteria of request
*
* @param string $sortfield List of sort fields, separated by comma. Example: 't1.fielda,t2.fieldb'
* @param string $sortorder Sort order, separated by comma. Example: 'ASC,DESC';
* @param string $sortorder Sort order, separated by comma. Example: 'ASC,DESC'. Note: If the quantity fo sortorder values is lower than sortfield, we used the last value for missing values.
* @return string String to provide syntax of a sort sql string
*/
public function order($sortfield = null, $sortorder = null)

View File

@ -663,9 +663,13 @@ class DoliDBMysqli extends DoliDB
$like = '';
if ($table) {
$like = "LIKE '".$table."'";
$tmptable = preg_replace('/[^a-z0-9\.\-\_%]/i', '', $table);
$like = "LIKE '".$this->escape($tmptable)."'";
}
$sql = "SHOW TABLES FROM ".$database." ".$like.";";
$tmpdatabase = preg_replace('/[^a-z0-9\.\-\_]/i', '', $database);
$sql = "SHOW TABLES FROM ".$tmpdatabase." ".$like.";";
//print $sql;
$result = $this->query($sql);
if ($result) {
@ -688,7 +692,9 @@ class DoliDBMysqli extends DoliDB
// phpcs:enable
$infotables = array();
$sql = "SHOW FULL COLUMNS FROM ".$table.";";
$tmptable = preg_replace('/[^a-z0-9\.\-\_]/i', '', $table);
$sql = "SHOW FULL COLUMNS FROM ".$tmptable.";";
dol_syslog($sql, LOG_DEBUG);
$result = $this->query($sql);
@ -794,7 +800,9 @@ class DoliDBMysqli extends DoliDB
public function DDLDropTable($table)
{
// phpcs:enable
$sql = "DROP TABLE ".$table;
$tmptable = preg_replace('/[^a-z0-9\.\-\_]/i', '', $table);
$sql = "DROP TABLE ".$tmptable;
if (!$this->query($sql)) {
return -1;
@ -925,8 +933,9 @@ class DoliDBMysqli extends DoliDB
public function DDLDropField($table, $field_name)
{
// phpcs:enable
$sql = "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`";
dol_syslog(get_class($this)."::DDLDropField ".$sql, LOG_DEBUG);
$tmp_field_name = preg_replace('/[^a-z0-9\.\-\_]/i', '', $field_name);
$sql = "ALTER TABLE ".$table." DROP COLUMN `".$tmp_field_name."`";
if ($this->query($sql)) {
return 1;
}

View File

@ -937,7 +937,9 @@ class DoliDBPgsql extends DoliDB
$escapedlike = '';
if ($table) {
$escapedlike = " AND table_name LIKE '".$this->escape($table)."'";
$tmptable = preg_replace('/[^a-z0-9\.\-\_%]/i', '', $table);
$escapedlike = " AND table_name LIKE '".$this->escape($tmptable)."'";
}
$result = pg_query($this->db, "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'".$escapedlike." ORDER BY table_name");
if ($result) {
@ -973,8 +975,8 @@ class DoliDBPgsql extends DoliDB
$sql .= " '' as \"Extra\",";
$sql .= " '' as \"Privileges\"";
$sql .= " FROM information_schema.columns infcol";
$sql .= " WHERE table_schema='public' ";
$sql .= " AND table_name='".$this->escape($table)."'";
$sql .= " WHERE table_schema = 'public' ";
$sql .= " AND table_name = '".$this->escape($table)."'";
$sql .= " ORDER BY ordinal_position;";
dol_syslog($sql, LOG_DEBUG);
@ -1078,7 +1080,9 @@ class DoliDBPgsql extends DoliDB
public function DDLDropTable($table)
{
// phpcs:enable
$sql = "DROP TABLE ".$table;
$tmptable = preg_replace('/[^a-z0-9\.\-\_]/i', '', $table);
$sql = "DROP TABLE ".$tmptable;
if (!$this->query($sql)) {
return -1;
@ -1236,8 +1240,9 @@ class DoliDBPgsql extends DoliDB
public function DDLDropField($table, $field_name)
{
// phpcs:enable
$sql = "ALTER TABLE ".$table." DROP COLUMN ".$field_name;
dol_syslog($sql, LOG_DEBUG);
$tmp_field_name = preg_replace('/[^a-z0-9\.\-\_]/i', '', $field_name);
$sql = "ALTER TABLE ".$table." DROP COLUMN ".$tmp_field_name;
if (!$this->query($sql)) {
$this->error = $this->lasterror();
return -1;

View File

@ -875,9 +875,13 @@ class DoliDBSqlite3 extends DoliDB
$like = '';
if ($table) {
$like = "LIKE '".$table."'";
$tmptable = preg_replace('/[^a-z0-9\.\-\_%]/i', '', $table);
$like = "LIKE '".$this->escape($tmptable)."'";
}
$sql = "SHOW TABLES FROM ".$database." ".$like.";";
$tmpdatabase = preg_replace('/[^a-z0-9\.\-\_]/i', '', $database);
$sql = "SHOW TABLES FROM ".$tmpdatabase." ".$like.";";
//print $sql;
$result = $this->query($sql);
if ($result) {
@ -901,7 +905,9 @@ class DoliDBSqlite3 extends DoliDB
// phpcs:enable
$infotables = array();
$sql = "SHOW FULL COLUMNS FROM ".$table.";";
$tmptable = preg_replace('/[^a-z0-9\.\-\_]/i', '', $table);
$sql = "SHOW FULL COLUMNS FROM ".$tmptable.";";
dol_syslog($sql, LOG_DEBUG);
$result = $this->query($sql);
@ -1002,7 +1008,9 @@ class DoliDBSqlite3 extends DoliDB
public function DDLDropTable($table)
{
// phpcs:enable
$sql = "DROP TABLE ".$table;
$tmptable = preg_replace('/[^a-z0-9\.\-\_]/i', '', $table);
$sql = "DROP TABLE ".$tmptable;
if (!$this->query($sql)) {
return -1;
@ -1112,8 +1120,9 @@ class DoliDBSqlite3 extends DoliDB
public function DDLDropField($table, $field_name)
{
// phpcs:enable
$sql = "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`";
dol_syslog(get_class($this)."::DDLDropField ".$sql, LOG_DEBUG);
$tmp_field_name = preg_replace('/[^a-z0-9\.\-\_]/i', '', $field_name);
$sql = "ALTER TABLE ".$table." DROP COLUMN `".$tmp_field_name."`";
if (!$this->query($sql)) {
$this->error = $this->lasterror();
return -1;

View File

@ -158,7 +158,7 @@ if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OP
}
}
$qs.=(($qs && $morequerystring)?'&':'').$morequerystring;
$text ='<a href="'.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.$qs.($qs?'&':'').'optioncss=print" target="_blank">';
$text ='<a href="'.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.$qs.($qs?'&':'').'optioncss=print" target="_blank" rel="noopener noreferrer">';
//$text.= img_picto(":".$langs->trans("PrintContentArea"), 'printer_top.png', 'class="printer"');
$text.='<span class="fa fa-print atoplogin"></span>';
$text.='</a>';
@ -191,7 +191,7 @@ if (empty($conf->global->MAIN_HELP_DISABLELINK) && empty($conf->global->MAIN_OPT
$title=$appli.'<br>';
$title.=$langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage': 'GoToHelpPage');
if ($mode == 'wiki') $title.=' - '.$langs->trans("PageWiki").' &quot;'.dol_escape_htmltag(strtr($helppage,'_',' ')).'&quot;';
$text.='<a class="help" target="_blank" rel="noopener" href="';
$text.='<a class="help" target="_blank" rel="noopener noreferrer" href="';
if ($mode == 'wiki') $text.=sprintf($helpbaseurl,urlencode(html_entity_decode($helppage)));
else $text.=sprintf($helpbaseurl,$helppage);
$text.='">';

View File

@ -295,7 +295,7 @@ function societe_prepare_head(Societe $object)
// Notifications
if (!empty($conf->notification->enabled)) {
$nbNotif = 0;
// Enable caching of thirdrparty count notifications
// Enable caching of thirdparty count notifications
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_notifications_thirdparty_'.$object->id;
$dataretrieved = dol_getcache($cachekey);

View File

@ -100,10 +100,10 @@ function dol_print_cron_urls()
print '<div class="div-table-responsive-no-min">';
print $langs->trans("URLToLaunchCronJobs").':<br>';
$url = $urlwithroot.'/public/cron/cron_run_jobs_by_url.php?'.(empty($conf->global->CRON_KEY) ? '' : 'securitykey='.$conf->global->CRON_KEY.'&').'userlogin='.$user->login;
print img_picto('', 'globe').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
print img_picto('', 'globe').' <a href="'.$url.'" target="_blank" rel="noopener noreferrer">'.$url."</a><br>\n";
print ' '.$langs->trans("OrToLaunchASpecificJob").'<br>';
$url = $urlwithroot.'/public/cron/cron_run_jobs_by_url.php?'.(empty($conf->global->CRON_KEY) ? '' : 'securitykey='.$conf->global->CRON_KEY.'&').'userlogin='.$user->login.'&id=cronjobid';
print img_picto('', 'globe').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
print img_picto('', 'globe').' <a href="'.$url.'" target="_blank" rel="noopener noreferrer">'.$url."</a><br>\n";
print '</div>';
print '<br>';

View File

@ -66,10 +66,6 @@ function show_skin($fuser, $edit = 0)
// Title
print '<tr class="liste_titre"><th width="35%">'.$langs->trans("DefaultSkin").'</th>';
print '<th class="right">';
$url = 'http://ckeditor.com/addons/skins/all';
/*print '<a href="'.$url.'" target="_blank">';
print $langs->trans('DownloadMoreSkins');
print '</a>';*/
print '</th></tr>';
print '<tr class="oddeven">';

View File

@ -132,7 +132,7 @@ function facturefourn_prepare_head($object)
* @param Object $object Object related to tabs
* @return array Array of tabs to show
*/
function ordersupplier_prepare_head($object)
function ordersupplier_prepare_head(CommandeFournisseur $object)
{
global $db, $langs, $conf, $user;
@ -159,6 +159,28 @@ function ordersupplier_prepare_head($object)
$langs->load("stocks");
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/dispatch.php?id='.$object->id;
$head[$h][1] = $langs->trans("OrderDispatch");
//If dispach process running we add the number of item to dispatch into the head
if (in_array($object->statut, array($object::STATUS_ORDERSENT, $object::STATUS_RECEIVED_PARTIALLY, $object::STATUS_RECEIVED_COMPLETELY))) {
$sumQtyAllreadyDispatched = 0;
$sumQtyOrdered = 0;
if (empty($object->lines)) {
$object->fetch_lines();
}
$nbLinesOrdered = count($object->lines);
$dispachedLines = $object->getDispachedLines(1);
$nbDispachedLines = count($dispachedLines);
for ($line = 0 ; $line < $nbDispachedLines; $line++) {
$sumQtyAllreadyDispatched = $sumQtyAllreadyDispatched + $dispachedLines[$line]['qty'];
}
for ($line = 0 ; $line < $nbLinesOrdered; $line++) {
$sumQtyOrdered = $sumQtyOrdered + $object->lines[$line]->qty;
}
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.price2num($sumQtyAllreadyDispatched, 'MS').' / '.price2num($sumQtyOrdered, 'MS').'</span>';
}
$head[$h][2] = 'dispatch';
$h++;
}

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