Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop#2
This commit is contained in:
commit
0d65fdad23
1
.gitignore
vendored
1
.gitignore
vendored
@ -55,3 +55,4 @@ yarn.lock
|
||||
package-lock.json
|
||||
|
||||
doc/install.lock
|
||||
/factory/
|
||||
|
||||
123
ChangeLog
123
ChangeLog
@ -105,6 +105,7 @@ NEW: Use an ajax call for the clicktodial feature instead of href link.
|
||||
NEW: when multiple order linked to facture, show list into note.
|
||||
NEW: when we delete several objects with massaction, if somes object has child we must see which objects are concerned and nevertheless delete objects which can be deleted
|
||||
NEW: Editing a page in website module keep old page with name .back
|
||||
NEW: External backups can be downloaded from the "About info page".
|
||||
|
||||
|
||||
For developers:
|
||||
@ -140,9 +141,128 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param).
|
||||
* The 'action=delete&file=...' has been replaced with 'action=deletefile&file=...' to avoid confusion with deletion of object lines.
|
||||
* Method getDictvalue has been renamed into getDictionaryValue to match camel case rule.
|
||||
* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in
|
||||
method executeCLI() available into core/class/utils.class.php
|
||||
|
||||
|
||||
|
||||
***** 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
|
||||
@ -497,7 +617,8 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* Removed deprecated substitution key __REFCLIENT__ (replaced with __REF_CLIENT__)
|
||||
* Removed constant MAIN_COUNTRIES_IN_EEC. You can now set if country is in Europe or not from the dictionary of countries.
|
||||
* v14 seems to work correctly on PHP v8 but it generates a lot of verbose warnings. Currently, v14 i snot yet officialy supported with PHP 8.
|
||||
|
||||
* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in
|
||||
method executeCLI() available into core/class/utils.class.php
|
||||
|
||||
|
||||
***** ChangeLog for 13.0.5 compared to 13.0.4 *****
|
||||
|
||||
BIN
dev/resources/iso-normes/14-pourquoi le format PDF A.pdf
Normal file
BIN
dev/resources/iso-normes/14-pourquoi le format PDF A.pdf
Normal file
Binary file not shown.
@ -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 {
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -127,7 +127,6 @@ if ($result) {
|
||||
$title = $langs->trans('AccountingPeriods');
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $addbutton, '', $limit, 1);
|
||||
|
||||
// Load attribute_label
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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++;
|
||||
}
|
||||
|
||||
@ -874,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) {
|
||||
|
||||
@ -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,6 +251,8 @@ 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');
|
||||
@ -259,28 +267,7 @@ if ($action == 'validatehistory') {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@ -532,6 +532,7 @@ if ($result) {
|
||||
// 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;
|
||||
@ -581,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');
|
||||
@ -594,28 +597,7 @@ if ($result) {
|
||||
}
|
||||
//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';
|
||||
@ -630,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">';
|
||||
|
||||
|
||||
@ -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>';
|
||||
}
|
||||
|
||||
@ -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,6 +247,8 @@ 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');
|
||||
@ -255,16 +263,7 @@ if ($action == 'validatehistory') {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@ -532,9 +532,9 @@ if ($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 !
|
||||
$objp->code_buy_l = '';
|
||||
$objp->code_buy_p = '';
|
||||
$objp->aarowid_suggest = ''; // Will be set later
|
||||
$code_buy_l = '';
|
||||
$code_buy_p = '';
|
||||
$code_buy_t = '';
|
||||
|
||||
$thirdpartystatic->id = $objp->socid;
|
||||
$thirdpartystatic->name = $objp->name;
|
||||
@ -585,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');
|
||||
@ -598,9 +600,6 @@ if ($result) {
|
||||
}
|
||||
//var_dump($return);
|
||||
|
||||
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
|
||||
// Not supported for suppliers
|
||||
|
||||
if (!empty($code_buy_p)) {
|
||||
// Value was defined previously
|
||||
} else {
|
||||
@ -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">';
|
||||
|
||||
|
||||
@ -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');
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
|
||||
}
|
||||
//if (!empty($objp->$key))
|
||||
// $objp->array_options[$tmpkey] = $objp->$key;
|
||||
//$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', 1); //$objp->$tmpkey;
|
||||
//$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', $object->table_element); //$objp->$tmpkey;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
@ -1397,6 +1398,7 @@ class Adherent extends CommonObject
|
||||
|
||||
$this->photo = $obj->photo;
|
||||
$this->statut = $obj->statut;
|
||||
$this->status = $obj->statut;
|
||||
$this->public = $obj->public;
|
||||
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
@ -1520,7 +1522,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 +2705,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 +2716,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 +2725,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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -543,14 +543,13 @@ class AdherentType extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of amount by type id
|
||||
* Return the array of all amounts per membership type id
|
||||
*
|
||||
* @param int $status Filter on status of type
|
||||
* @return array List of types of members
|
||||
* @return array Array of membership type
|
||||
*/
|
||||
public function amountByType($status = null)
|
||||
{
|
||||
|
||||
global $conf, $langs;
|
||||
|
||||
$amountbytype = array();
|
||||
@ -578,6 +577,7 @@ class AdherentType extends CommonObject
|
||||
} else {
|
||||
print $this->db->error();
|
||||
}
|
||||
|
||||
return $amountbytype;
|
||||
}
|
||||
|
||||
|
||||
@ -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.'&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";
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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";
|
||||
}
|
||||
|
||||
|
||||
@ -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">';
|
||||
|
||||
@ -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 : ' ');
|
||||
}
|
||||
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
|
||||
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -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,11 +280,12 @@ 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
|
||||
// Set and check version
|
||||
$version = '';
|
||||
if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) {
|
||||
if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) {
|
||||
//compatible
|
||||
@ -316,17 +317,22 @@ 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>
|
||||
<td class="margeCote"><h2 class="appTitle">'.dol_escape_htmltag($product->name->language[$this->lang - 1])
|
||||
.'<br><small>'.dol_escape_htmltag($version).'</small></h2>
|
||||
<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.dol_escape_htmltag($product->reference).' - '.dol_escape_htmltag($langs->trans('Id')).': '.((int) $product->id).'</small><br><br>'.dol_escape_htmltag($product->description_short->language[$this->lang - 1]).'</td>';
|
||||
$html .= '<tr class="app oddeven '.dol_escape_htmltag($compatible).'">';
|
||||
$html .= '<td class="center" width="210"><div class="newAppParent">';
|
||||
$html .= $newapp.$images; // No dol_escape_htmltag, it is already escape html
|
||||
$html .= '</div></td>';
|
||||
$html .= '<td class="margeCote"><h2 class="appTitle">';
|
||||
$html .= dol_escape_htmltag($product->name->language[$this->lang - 1]);
|
||||
$html .= '<br><small>';
|
||||
$html .= $version; // No dol_escape_htmltag, it is already escape html
|
||||
$html .= '</small></h2>';
|
||||
$html .= '<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.dol_escape_htmltag($product->reference).' - '.dol_escape_htmltag($langs->trans('Id')).': '.((int) $product->id).'</small><br><br>'.dol_escape_htmltag($product->description_short->language[$this->lang - 1]).'</td>';
|
||||
// do not load if display none
|
||||
//$html .= '<td style="display:none;" class="long_description">'.$product->description->language[$this->lang - 1].'</td>';
|
||||
$html .= '<td class="margeCote center">'.dol_escape_htmltag($price).'</td>';
|
||||
$html .= '<td class="margeCote center">';
|
||||
$html .= $price;
|
||||
$html .= '</td>';
|
||||
$html .= '<td class="margeCote">'.$download_link.'</td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -469,13 +469,17 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
|
||||
print load_fiche_titre($langs->trans('OtherOptions'), '', '');
|
||||
|
||||
if (empty($conf->global->HRM_MAXRANK)) {
|
||||
$conf->global->HRM_MAXRANK = Skill::DEFAULT_MAX_RANK_PER_SKILL;
|
||||
}
|
||||
|
||||
if ($action == 'edit') {
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach ($arrayofparameters as $constname => $val) {
|
||||
if ($val['enabled']==1) {
|
||||
@ -571,7 +575,7 @@ if ($action == 'edit') {
|
||||
} else {
|
||||
if (!empty($arrayofparameters)) {
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach ($arrayofparameters as $constname => $val) {
|
||||
if ($val['enabled']==1) {
|
||||
|
||||
@ -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> </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>';
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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
|
||||
|
||||
@ -326,6 +326,13 @@ if ($mode == 'desc') {
|
||||
$textexternal = '';
|
||||
if ($objMod->isCoreOrExternalModule() == 'external') {
|
||||
$textexternal .= '<br><span class="opacitymedium">'.$langs->trans("Origin").':</span> '.$langs->trans("ExternalModule").' - '.$langs->trans("InstalledInto", $dirofmodule);
|
||||
|
||||
global $dolibarr_allow_download_external_modules;
|
||||
if (!empty($dolibarr_allow_download_external_modules) && preg_match('/\/custom\//', $dirofmodule)) {
|
||||
// Add a link to download a zip of the module
|
||||
$textexternal .= ' <a href="'.DOL_URL_ROOT.'/admin/tools/export_files.php?export_type=externalmodule&what='.urlencode($moduledir).'&compression=zip&zipfilename_template=module_'.$moduledir.'-'.$version.'.notorig" target="_blank" rel="noopener">'.img_picto('', 'download').'</a>';
|
||||
}
|
||||
|
||||
if ($objMod->editor_name != 'dolibarr') {
|
||||
$textexternal .= '<br><span class="opacitymedium">'.$langs->trans("Publisher").':</span> '.(empty($objMod->editor_name) ? $langs->trans("Unknown") : $objMod->editor_name);
|
||||
}
|
||||
@ -334,7 +341,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>';
|
||||
|
||||
@ -303,7 +303,7 @@ llxHeader('', $langs->trans("Setup"), $help_url, '', '', '', $morejs, $morecss,
|
||||
// Search modules dirs
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
|
||||
$arrayofnatures = array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - ['.$langs->trans("AllPublishers").']');
|
||||
$arrayofnatures = array('core'=>$langs->transnoentitiesnoconv("NativeModules"), 'external'=>$langs->transnoentitiesnoconv("External").' - ['.$langs->trans("AllPublishers").']');
|
||||
$arrayofwarnings = array(); // Array of warning each module want to show when activated
|
||||
$arrayofwarningsext = array(); // Array of warning each module want to show when we activate an external module
|
||||
$filename = array();
|
||||
@ -526,7 +526,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
|
||||
$moreforfilter = '<div class="valignmiddle">';
|
||||
|
||||
$moreforfilter .= '<div class="floatright right pagination --module-list"><ul><li>';
|
||||
$moreforfilter .= '<div class="floatright right pagination paddingtop --module-list"><ul><li>';
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('CheckForModuleUpdate'), $langs->trans('CheckForModuleUpdate').'<br>'.$langs->trans('CheckForModuleUpdateHelp'), 'fa fa-sync', $_SERVER["PHP_SELF"].'?action=checklastversion&token='.newToken().'&mode='.$mode.$param, '', 1, array('morecss'=>'reposition'));
|
||||
$moreforfilter .= dolGetButtonTitleSeparator();
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
@ -563,8 +563,10 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
$moreforfilter .= ' ';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= '<input type="submit" name="buttonsubmit" class="button" value="'.dol_escape_htmltag($langs->trans("Refresh")).'">';
|
||||
$moreforfilter .= ' ';
|
||||
$moreforfilter .= '<input type="submit" name="buttonreset" class="butActionDelete noborderbottom" value="'.dol_escape_htmltag($langs->trans("Reset")).'">';
|
||||
if ($search_keyword || $search_status || $search_nature || $search_version) {
|
||||
$moreforfilter .= ' ';
|
||||
$moreforfilter .= '<input type="submit" name="buttonreset" class="buttonreset noborderbottom" value="'.dol_escape_htmltag($langs->trans("Reset")).'">';
|
||||
}
|
||||
$moreforfilter .= '</div>';
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
@ -597,6 +599,9 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
$oldfamily = '';
|
||||
$foundoneexternalmodulewithupdate = 0;
|
||||
$linenum = 0;
|
||||
$atleastonequalified = 0;
|
||||
$atleastoneforfamily = 0;
|
||||
|
||||
foreach ($orders as $key => $value) {
|
||||
$linenum++;
|
||||
$tab = explode('_', $value);
|
||||
@ -685,7 +690,9 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
}
|
||||
}
|
||||
|
||||
// Load all lang files of module
|
||||
$atleastonequalified++;
|
||||
|
||||
// Load all language files of the qualified module
|
||||
if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
|
||||
foreach ($objMod->langfiles as $domain) {
|
||||
$langs->load($domain);
|
||||
@ -972,6 +979,10 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
}
|
||||
}
|
||||
|
||||
if (!$atleastonequalified) {
|
||||
print '<br><span class="opacitymedium">'.$langs->trans("NoDeployedModulesFoundWithThisSearchCriteria").'</span><br><br>';
|
||||
}
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print '<br>';
|
||||
@ -1000,9 +1011,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";
|
||||
@ -1051,7 +1062,9 @@ if ($mode == 'marketplace') {
|
||||
|
||||
<div id="category-tree-left">
|
||||
<ul class="tree">
|
||||
<?php echo dol_escape_htmltag($dolistore->get_categories()); ?>
|
||||
<?php
|
||||
echo $dolistore->get_categories(); // Do not use dol_escape_htmltag here, it is already a structured content
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="listing-content">
|
||||
@ -1081,7 +1094,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 +1286,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";
|
||||
|
||||
@ -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" /> ';
|
||||
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').'" /> ';
|
||||
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>';
|
||||
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -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 ' <a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank">'.$langs->trans("SeeChangeLog").'</a>';
|
||||
print ' <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 ' <a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank">'.$langs->trans("SeeChangeLog").'</a>';
|
||||
print ' <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>';
|
||||
|
||||
@ -88,9 +88,9 @@ if (function_exists('exec')) {
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
print "<strong>PHP session.use_strict_mode</strong> = ".(ini_get('session.use_strict_mode') ? ini_get('session.use_strict_mode') : yn(0)).' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
|
||||
print "<strong>PHP session.use_only_cookies</strong> = ".(ini_get('session.use_only_cookies') ? ini_get('session.use_only_cookies') : yn(0)).' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
|
||||
print "<strong>PHP session.cookie_httponly</strong> = ".(ini_get('session.cookie_httponly') ? ini_get('session.cookie_httponly') : '').' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
|
||||
print "<strong>PHP session.use_strict_mode</strong> = ".(ini_get('session.use_strict_mode') ? '' : img_warning().' ').(ini_get('session.use_strict_mode') ? ini_get('session.use_strict_mode') : yn(0)).' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
|
||||
print "<strong>PHP session.use_only_cookies</strong> = ".(ini_get('session.use_only_cookies') ? '' : img_warning().' ').(ini_get('session.use_only_cookies') ? ini_get('session.use_only_cookies') : yn(0)).' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
|
||||
print "<strong>PHP session.cookie_httponly</strong> = ".(ini_get('session.cookie_httponly') ? '' : img_warning().' ').(ini_get('session.cookie_httponly') ? ini_get('session.cookie_httponly') : '').' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", '1').")</span><br>\n";
|
||||
print "<strong>PHP session.cookie_samesite</strong> = ".(ini_get('session.cookie_samesite') ? ini_get('session.cookie_samesite') : 'None');
|
||||
if (!ini_get('session.cookie_samesite') || ini_get('session.cookie_samesite') == 'Lax') {
|
||||
print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", 'Lax').")</span>";
|
||||
|
||||
@ -70,9 +70,14 @@ if ($labeluser && $labelgroup) {
|
||||
if (function_exists('exec')) {
|
||||
$arrayout = array(); $varout = 0;
|
||||
exec('id', $arrayout, $varout);
|
||||
print '<tr><td>'.$langs->trans("WebUserGroup")." (real, 'id' command)</td><td>";
|
||||
if (empty($varout)) { // Test command is ok. Work only on Linux OS.
|
||||
print '<tr><td>'.$langs->trans("WebUserGroup")." (real, 'id' command)</td><td>".join(',', $arrayout)."</td></tr>\n";
|
||||
print join(',', $arrayout);
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
print '<span class="opacitymedium">'.$langs->trans("ErrorExecIdFailed").'</span>';
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -145,6 +145,8 @@ print "<!-- Dump of a server -->\n";
|
||||
print '<form method="post" action="export.php" name="dump">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'" />';
|
||||
print '<input type="hidden" name="export_type" value="server" />';
|
||||
print '<input type="hidden" name="page_y" value="" />';
|
||||
|
||||
print '<fieldset id="fieldsetexport"><legend class="legendforfieldsetstep" style="font-size: 3em">1</legend>';
|
||||
|
||||
print '<span class="opacitymedium">';
|
||||
@ -160,14 +162,15 @@ $title = $langs->trans("BackupDumpWizard");
|
||||
|
||||
print load_fiche_titre($title);
|
||||
|
||||
print '<table class="'.(!empty($useinecm) ? 'nobordernopadding' : 'liste noborderbottom').' nohover centpercent">';
|
||||
print '<table class="liste nohover centpercent noborderbottom">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b><br>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="oddeven nohover"><td style="padding-left: 8px" class="nohover">';
|
||||
print '<table class="centpercent">';
|
||||
|
||||
print '<table class="centpercent noborderbottom">';
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">';
|
||||
|
||||
@ -397,11 +400,15 @@ print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
print '<!--<fieldset>';
|
||||
print '<legend>'.$langs->trans("Destination").'</legend> -->';
|
||||
print '<br>';
|
||||
print '<label for="filename_template">'.$langs->trans("FileNameToGenerate").'</label>';
|
||||
print '<label for="filename_template" class="line-height-large">'.$langs->trans("FileNameToGenerate").'</label>';
|
||||
print '<br>';
|
||||
$prefix = 'dump';
|
||||
$ext = '.sql';
|
||||
@ -437,9 +444,9 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
// 'label' => $langs->trans("FormatZip")
|
||||
// );
|
||||
$compression['bz'] = array(
|
||||
'function' => 'bzopen',
|
||||
'id' => 'radio_compression_bzip',
|
||||
'label' => $langs->trans("Bzip2")
|
||||
'function' => 'bzopen',
|
||||
'id' => 'radio_compression_bzip',
|
||||
'label' => $langs->trans("Bzip2")
|
||||
);
|
||||
$compression['zstd'] = array(
|
||||
'function' => 'zstd_compress',
|
||||
@ -498,7 +505,6 @@ print "<!--</fieldset>--> <!-- End destination -->\n";
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button reposition" value="'.$langs->trans("GenerateBackup").'" id="buttonGo">';
|
||||
print '<input type="hidden" name="page_y" value="'.GETPOST('page_y', 'int').'">';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
@ -532,8 +538,6 @@ if (!empty($_SESSION["commandbackuptorun"])) {
|
||||
|
||||
print "</div> <!-- end div center button -->\n";
|
||||
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print "</div> <!-- end div fichehalfleft -->\n";
|
||||
|
||||
@ -569,7 +573,7 @@ print '<div id="backupfilesleft" class="fichehalfleft">';
|
||||
|
||||
print load_fiche_titre($title ? $title : $langs->trans("BackupZipWizard"));
|
||||
|
||||
print '<label for="zipfilename_template">'.$langs->trans("FileNameToGenerate").'</label><br>';
|
||||
print '<label for="zipfilename_template" class="line-height-large paddingbottom">'.$langs->trans("FileNameToGenerate").'</label><br>';
|
||||
$prefix = 'documents';
|
||||
$ext = 'zip';
|
||||
$file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M");
|
||||
@ -617,7 +621,7 @@ print '</div>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">';
|
||||
print '<div id="backupfileright" class="fichehalfright" style="height:250px; overflow: auto;">';
|
||||
|
||||
$filearray = dol_dir_list($conf->admin->dir_output.'/documents', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
|
||||
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousArchiveFiles"));
|
||||
|
||||
@ -216,8 +216,7 @@ if ($errormsg) {
|
||||
}*/
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
// Redirect to backup page
|
||||
header("Location: dolibarr_export.php".(GETPOST('page_y', 'int') ? '?page_y='.GETPOST('page_y', 'int') : ''));
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -127,10 +127,34 @@ $result = dol_mkdir($outputdir);
|
||||
|
||||
$utils = new Utils($db);
|
||||
|
||||
if ($export_type == 'externalmodule' && ! empty($what)) {
|
||||
$fulldirtocompress = DOL_DOCUMENT_ROOT.'/custom/'.dol_sanitizeFileName($what);
|
||||
} else {
|
||||
$fulldirtocompress = DOL_DATA_ROOT;
|
||||
}
|
||||
$dirtoswitch = dirname($fulldirtocompress);
|
||||
$dirtocompress = basename($fulldirtocompress);
|
||||
|
||||
if ($compression == 'zip') {
|
||||
$file .= '.zip';
|
||||
$excludefiles = '/(\.back|\.old|\.log|[\/\\\]temp[\/\\\]|documents[\/\\\]admin[\/\\\]documents[\/\\\])/i';
|
||||
$ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression, $excludefiles);
|
||||
|
||||
//var_dump($fulldirtocompress);
|
||||
//var_dump($outputdir."/".$file);exit;
|
||||
|
||||
$rootdirinzip = '';
|
||||
if ($export_type == 'externalmodule' && !empty($what)) {
|
||||
$rootdirinzip = $what;
|
||||
|
||||
global $dolibarr_allow_download_external_modules;
|
||||
if (empty($dolibarr_allow_download_external_modules)) {
|
||||
print 'Download of external modules is not allowed by $dolibarr_allow_download_external_modules in conf.php file';
|
||||
$db->close();
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$ret = dol_compress_dir($fulldirtocompress, $outputdir."/".$file, $compression, $excludefiles, $rootdirinzip);
|
||||
if ($ret < 0) {
|
||||
if ($ret == -2) {
|
||||
$langs->load("errors");
|
||||
@ -146,10 +170,12 @@ if ($compression == 'zip') {
|
||||
$outputfile = $conf->admin->dir_temp.'/export_files.'.$userlogin.'.out'; // File used with popen method
|
||||
|
||||
$file .= '.tar';
|
||||
// We also exclude '/temp/' dir and 'documents/admin/documents'
|
||||
$cmd = "tar -cf ".$outputdir."/".$file." --exclude-vcs --exclude 'temp' --exclude 'dolibarr.log' --exclude 'dolibarr_*.log' --exclude 'documents/admin/documents' -C ".dirname(DOL_DATA_ROOT)." ".basename(DOL_DATA_ROOT);
|
||||
|
||||
$result = $utils->executeCLI($cmd, $outputfile);
|
||||
// We also exclude '/temp/' dir and 'documents/admin/documents'
|
||||
// We make escapement here and call executeCLI without escapement because we don't want to have the '*.log' escaped.
|
||||
$cmd = "tar -cf ".escapeshellcmd($outputdir."/".$file)." --exclude-vcs --exclude-caches-all --exclude='temp' --exclude='*.log' --exclude='documents/admin/documents' -C '".escapeshellcmd(dol_sanitizePathName($dirtoswitch))."' '".escapeshellcmd(dol_sanitizeFileName($dirtocompress))."'";
|
||||
|
||||
$result = $utils->executeCLI($cmd, $outputfile, 0, null, 1);
|
||||
|
||||
$retval = $result['error'];
|
||||
if ($result['result'] || !empty($retval)) {
|
||||
@ -173,15 +199,37 @@ if ($compression == 'zip') {
|
||||
unlink($outputdir."/".$file);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$errormsg = 'Bad value for compression method';
|
||||
print $errormsg;
|
||||
}
|
||||
|
||||
if ($errormsg) {
|
||||
setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors');
|
||||
if ($export_type != 'externalmodule' || empty($what)) {
|
||||
if ($errormsg) {
|
||||
setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans("BackupFileSuccessfullyCreated").'.<br>'.$langs->trans("YouCanDownloadBackupFile"), null, 'mesgs');
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
// Redirect to calling page
|
||||
$returnto = 'dolibarr_export.php';
|
||||
|
||||
header("Location: ".$returnto);
|
||||
exit();
|
||||
} else {
|
||||
$zipname = $outputdir."/".$file;
|
||||
|
||||
// Then download the zipped file.
|
||||
header('Content-Type: application/zip');
|
||||
header('Content-disposition: attachment; filename='.basename($zipname));
|
||||
header('Content-Length: '.filesize($zipname));
|
||||
readfile($zipname);
|
||||
|
||||
dol_delete_file($zipname);
|
||||
|
||||
$db->close();
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
// Redirect t backup page
|
||||
header("Location: dolibarr_export.php");
|
||||
|
||||
$time_end = time();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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'
|
||||
)
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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++;
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -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']) {
|
||||
|
||||
@ -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>';
|
||||
}
|
||||
|
||||
@ -185,10 +185,7 @@ if ($resql) {
|
||||
// Show file name with link to download
|
||||
$out .= '<a href="'.$documenturl.'?modulepart='.$modulepart.'&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";
|
||||
|
||||
@ -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)) {
|
||||
|
||||
@ -678,6 +678,10 @@ if (empty($reshook)) {
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ($qty < 0) {
|
||||
setEventMessages($langs->trans('FieldCannotBeNegative', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && empty($product_desc)) {
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors');
|
||||
$error++;
|
||||
@ -1002,9 +1006,11 @@ if (empty($reshook)) {
|
||||
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
||||
$description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml'));
|
||||
$pu_ht = price2num(GETPOST('price_ht'), '', 2);
|
||||
$vat_rate = (GETPOST('tva_tx') ?GETPOST('tva_tx') : 0);
|
||||
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx', 'alpha') : 0);
|
||||
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
|
||||
|
||||
$qty = price2num(GETPOST('qty'), 'MS');
|
||||
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
if (preg_match('/\*/', $vat_rate)) {
|
||||
@ -1056,6 +1062,7 @@ if (empty($reshook)) {
|
||||
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - $remise_percent / 100) < price2num($price_min)))) {
|
||||
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
|
||||
$error++;
|
||||
$action = 'editline';
|
||||
}
|
||||
} else {
|
||||
$type = GETPOST('type');
|
||||
@ -1065,9 +1072,16 @@ if (empty($reshook)) {
|
||||
if (GETPOST('type') < 0) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
|
||||
$error++;
|
||||
$action = 'editline';
|
||||
}
|
||||
}
|
||||
|
||||
if ($qty < 0) {
|
||||
setEventMessages($langs->trans('FieldCannotBeNegative', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
|
||||
$error++;
|
||||
$action = 'editline';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if (empty($user->rights->margins->creer)) {
|
||||
foreach ($object->lines as &$line) {
|
||||
@ -1078,7 +1092,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
$result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, price2num(GETPOST('qty'), 'MS'), $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'), $pu_ht_devise);
|
||||
$result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'), $pu_ht_devise);
|
||||
|
||||
if ($result >= 0) {
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
@ -1130,7 +1144,7 @@ if (empty($reshook)) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'updateline' && $usercancreate && GETPOST('cancel', 'alpha') == $langs->trans("Cancel")) {
|
||||
} elseif ($action == 'updateline' && $usercancreate && GETPOST('cancel', 'alpha')) {
|
||||
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition
|
||||
exit();
|
||||
} elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) {
|
||||
@ -1688,7 +1702,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Source / Channle - What trigger creation
|
||||
// Source / Channel - What trigger creation
|
||||
print '<tr><td>'.$langs->trans('Channel').'</td><td>';
|
||||
print img_picto('', 'question', 'class="pictofixedwidth"');
|
||||
$form->selectInputReason($demand_reason_id, 'demand_reason_id', '', 1, 'maxwidth200 widthcentpercentminusx');
|
||||
|
||||
@ -499,7 +499,7 @@ if ($result && $action == "dl" && !$error) {
|
||||
$zip->addFromString('transactions.csv', $log);
|
||||
$zip->close();
|
||||
|
||||
///Then download the zipped file.
|
||||
// Then download the zipped file.
|
||||
header('Content-Type: application/zip');
|
||||
header('Content-disposition: attachment; filename='.basename($zipname));
|
||||
header('Content-Length: '.filesize($zipname));
|
||||
@ -736,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> '.$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> '.$formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name']).'<br>';
|
||||
}
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
@ -429,7 +429,7 @@ if ($action == 'create') {
|
||||
print '<tr><td>'.$langs->trans("Web").'</td>';
|
||||
print '<td>';
|
||||
print img_picto('', 'globe', 'class="pictofixedwidth"');
|
||||
print '<input class="minwidth300" type="text" class="flat" name="url" value="'.GETPOST("url").'">';
|
||||
print '<input class="minwidth300 widthcentpercentminusx maxwidth500" type="text" class="flat" name="url" value="'.GETPOST("url").'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Tags-Categories
|
||||
|
||||
@ -415,7 +415,7 @@ if ($action == 'create') {
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).'</td><td>';
|
||||
$form->select_comptes($accountid, "accountid", 0, '', 2); // Affiche liste des comptes courant
|
||||
print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes($accountid, "accountid", 0, '', 2, '', 0, '', 1); // Affiche liste des comptes courant
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -490,9 +490,8 @@ if ($action == 'create') {
|
||||
$langs->load("projects");
|
||||
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||
|
||||
$numproject = $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
|
||||
|
||||
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
|
||||
print $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -160,7 +160,7 @@ $arrayfields = array(
|
||||
'ref' =>array('label'=>"Ref", 'checked'=>1, 'position'=>100),
|
||||
'label' =>array('label'=>"Label", 'checked'=>1, 'position'=>110),
|
||||
'datep' =>array('label'=>"DatePayment", 'checked'=>1, 'position'=>120),
|
||||
'datev' =>array('label'=>"DateValue", 'checked'=>1, 'position'=>130),
|
||||
'datev' =>array('label'=>"DateValue", 'checked'=>-1, 'position'=>130),
|
||||
'type' =>array('label'=>"PaymentMode", 'checked'=>1, 'position'=>140),
|
||||
'project' =>array('label'=>"Project", 'checked'=>1, 'position'=>200, "enabled"=>!empty($conf->projet->enabled)),
|
||||
'bank' =>array('label'=>"BankAccount", 'checked'=>1, 'position'=>300, "enabled"=>!empty($conf->banque->enabled)),
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -1066,7 +1066,7 @@ if ($action == 'create') {
|
||||
|
||||
// Autogeneration
|
||||
$title = $langs->trans("Recurrence");
|
||||
print load_fiche_titre('<span class="fa fa-calendar"></span> '.$title, '', '');
|
||||
print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"').$title, '', '');
|
||||
|
||||
print dol_get_fiche_head(null, '', '', 0);
|
||||
|
||||
@ -1455,7 +1455,7 @@ if ($action == 'create') {
|
||||
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
print '<tr><td colspan="2"><span class="fa fa-calendar"></span> '.$title.'</td></tr>';
|
||||
print '<tr><td colspan="2">'.img_picto('', 'recurring', 'class="pictofixedwidth"').$title.'</td></tr>';
|
||||
|
||||
// if "frequency" is empty or = 0, the reccurence is disabled
|
||||
print '<tr><td style="width: 50%">';
|
||||
|
||||
@ -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
|
||||
|
||||
@ -141,7 +141,7 @@ $arrayfields = array(
|
||||
'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>1),
|
||||
'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0),
|
||||
'f.fk_cond_reglement'=>array('label'=>"PaymentTerm", 'checked'=>0),
|
||||
'recurring'=>array('label'=>"RecurringInvoiceTemplate", 'checked'=>1),
|
||||
'recurring'=>array('label'=>"RecurringInvoice", 'checked'=>1),
|
||||
'f.frequency'=>array('label'=>"Frequency", 'checked'=>1),
|
||||
'f.unit_frequency'=>array('label'=>"FrequencyUnit", 'checked'=>1),
|
||||
'f.nb_gen_done'=>array('label'=>"NbOfGenerationDoneShort", 'checked'=>1),
|
||||
@ -359,7 +359,11 @@ if ($search_date_when_end) {
|
||||
$sql .= " AND f.date_when <= '".$db->idate($search_date_when_end)."'";
|
||||
}
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
$tmpsortfield = $sortfield;
|
||||
if ($tmpsortfield == 'recurring') {
|
||||
$tmpsortfield = 'f.frequency';
|
||||
}
|
||||
$sql .= $db->order($tmpsortfield, $sortorder);
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
@ -773,8 +777,9 @@ if ($resql) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Is it a recurring invoice
|
||||
if (!empty($arrayfields['recurring']['checked'])) {
|
||||
print '<td class="center">'.yn($objp->frequency ? 1 : 0).'</td>';
|
||||
print '<td class="center">'.($objp->frequency ? img_picto($langs->trans("Frequency").': '.$objp->frequency.' '.$objp->unit_frequency, 'recurring', 'class="opacitymedium"').' ' : '').yn($objp->frequency ? 1 : 0).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -331,6 +331,12 @@ $dolibarr_cron_allow_cli='0';
|
||||
// Examples:
|
||||
// $dolibarr_strict_mode=0;
|
||||
|
||||
// dolibarr_allow_download_external_modules
|
||||
// Provide a link to download the zip of an external modules installed into custom directory from the web admin.
|
||||
// Default value: 0
|
||||
// Examples:
|
||||
// $dolibarr_allow_download_external_modules=0;
|
||||
|
||||
|
||||
|
||||
//#################################
|
||||
|
||||
@ -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.'&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";
|
||||
}
|
||||
|
||||
|
||||
@ -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']) {
|
||||
|
||||
@ -46,7 +46,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
<td><?php echo $langs->trans("Contract"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td class="nowraponall"><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td></td>
|
||||
<td class="center"><?php echo dol_print_date($objectlink->date_contrat, 'day'); ?></td>
|
||||
<td class="right"><?php
|
||||
|
||||
@ -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 = '';
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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++;
|
||||
|
||||
@ -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");
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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';
|
||||
@ -7862,7 +7862,7 @@ abstract class CommonObject
|
||||
|
||||
switch ($mode) {
|
||||
case "view":
|
||||
$out .= $extrafields->showOutputField($key, $value);
|
||||
$out .= $extrafields->showOutputField($key, $value, '', $this->table_element);
|
||||
break;
|
||||
case "create":
|
||||
$out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element);
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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'
|
||||
}
|
||||
|
||||
@ -42,12 +42,6 @@ class ExtraFields
|
||||
*/
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* @var array Array with type of element (for what object is the extrafield)
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_elementtype;
|
||||
|
||||
/**
|
||||
* @var array Array with type of the extra field
|
||||
* @deprecated
|
||||
@ -60,90 +54,12 @@ class ExtraFields
|
||||
*/
|
||||
public $attribute_label;
|
||||
|
||||
/**
|
||||
* @var array Array with size of extra field
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_size;
|
||||
|
||||
/**
|
||||
* @var array Array with list of possible values for some types of extra fields
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_choice;
|
||||
|
||||
/**
|
||||
* @var array Array to store compute formula for computed fields
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_computed;
|
||||
|
||||
/**
|
||||
* @var array Array to store default value
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_default;
|
||||
|
||||
/**
|
||||
* @var array Array to store if attribute is unique or not
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_unique;
|
||||
|
||||
/**
|
||||
* @var array Array to store if attribute is required or not
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_required;
|
||||
|
||||
/**
|
||||
* @var array Array to store parameters of attribute (used in select type)
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_param;
|
||||
|
||||
/**
|
||||
* @var array Array to store position of attribute
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_pos;
|
||||
|
||||
/**
|
||||
* @var array Array to store if attribute is editable regardless of the document status
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_alwayseditable;
|
||||
|
||||
/**
|
||||
* @var array Array to store permission to check
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_perms;
|
||||
|
||||
/**
|
||||
* @var array Array to store language file to translate label of values
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_langfile;
|
||||
|
||||
/**
|
||||
* @var array Array to store if field is visible by default on list
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_list;
|
||||
|
||||
/**
|
||||
* @var array Array to store if field is summable
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_totalizable;
|
||||
|
||||
/**
|
||||
* @var array Array to store entity id of extrafield
|
||||
* @deprecated
|
||||
*/
|
||||
public $attribute_entityid;
|
||||
|
||||
|
||||
/**
|
||||
* @var array New array to store extrafields definition
|
||||
@ -203,17 +119,8 @@ class ExtraFields
|
||||
$this->attributes = array();
|
||||
|
||||
// For old usage
|
||||
$this->attribute_elementtype = array();
|
||||
$this->attribute_type = array();
|
||||
$this->attribute_label = array();
|
||||
$this->attribute_size = array();
|
||||
$this->attribute_computed = array();
|
||||
$this->attribute_default = array();
|
||||
$this->attribute_unique = array();
|
||||
$this->attribute_required = array();
|
||||
$this->attribute_perms = array();
|
||||
$this->attribute_langfile = array();
|
||||
$this->attribute_list = array();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -238,7 +145,7 @@ class ExtraFields
|
||||
* @param string $langfile Language file
|
||||
* @param string $enabled Condition to have the field enabled or not
|
||||
* @param int $totalizable Is a measure. Must show a total on lists
|
||||
* @param int $printable Is extrafield displayed on PDF
|
||||
* @param int $printable Is extrafield displayed on PDF
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
public function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0)
|
||||
@ -873,7 +780,7 @@ class ExtraFields
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Load array this->attributes, or old this->attribute_xxx like attribute_label, attribute_type, ...
|
||||
* Load array this->attributes (and some old this->attribute_xxx like attribute_label, attribute_type, ...
|
||||
*
|
||||
* @param string $elementtype Type of element ('' = all or $object->table_element like 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
|
||||
* @param boolean $forceload Force load of extra fields whatever is status of cache.
|
||||
@ -932,20 +839,6 @@ class ExtraFields
|
||||
// Old usage
|
||||
$this->attribute_type[$tab->name] = $tab->type;
|
||||
$this->attribute_label[$tab->name] = $tab->label;
|
||||
$this->attribute_size[$tab->name] = $tab->size;
|
||||
$this->attribute_elementtype[$tab->name] = $tab->elementtype;
|
||||
$this->attribute_default[$tab->name] = $tab->fielddefault;
|
||||
$this->attribute_computed[$tab->name] = $tab->fieldcomputed;
|
||||
$this->attribute_unique[$tab->name] = $tab->fieldunique;
|
||||
$this->attribute_required[$tab->name] = $tab->fieldrequired;
|
||||
$this->attribute_param[$tab->name] = ($tab->param ? jsonOrUnserialize($tab->param) : '');
|
||||
$this->attribute_pos[$tab->name] = $tab->pos;
|
||||
$this->attribute_alwayseditable[$tab->name] = $tab->alwayseditable;
|
||||
$this->attribute_perms[$tab->name] = (strlen($tab->perms) == 0 ? 1 : $tab->perms);
|
||||
$this->attribute_langfile[$tab->name] = $tab->langs;
|
||||
$this->attribute_list[$tab->name] = $tab->list;
|
||||
$this->attribute_totalizable[$tab->name] = $tab->totalizable;
|
||||
$this->attribute_entityid[$tab->name] = $tab->entity;
|
||||
|
||||
// New usage
|
||||
$this->attributes[$tab->elementtype]['type'][$tab->name] = $tab->type;
|
||||
@ -1028,20 +921,10 @@ class ExtraFields
|
||||
$totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key];
|
||||
$help = $this->attributes[$extrafieldsobjectkey]['help'][$key];
|
||||
$hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
||||
} else // Old usage
|
||||
{
|
||||
} else {
|
||||
// Old usage
|
||||
$label = $this->attribute_label[$key];
|
||||
$type = $this->attribute_type[$key];
|
||||
$size = $this->attribute_size[$key];
|
||||
$elementtype = $this->attribute_elementtype[$key]; // Seems not used
|
||||
$default = $this->attribute_default[$key];
|
||||
$computed = $this->attribute_computed[$key];
|
||||
$unique = $this->attribute_unique[$key];
|
||||
$required = $this->attribute_required[$key];
|
||||
$param = $this->attribute_param[$key];
|
||||
$langfile = $this->attribute_langfile[$key];
|
||||
$list = $this->attribute_list[$key];
|
||||
$totalizable = $this->attribute_totalizable[$key];
|
||||
$hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
||||
}
|
||||
|
||||
@ -1626,20 +1509,10 @@ class ExtraFields
|
||||
$list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1);
|
||||
$help = $this->attributes[$extrafieldsobjectkey]['help'][$key];
|
||||
$hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
||||
} else // Old usage
|
||||
{
|
||||
//dol_syslog("Warning: parameter 'extrafieldsobjectkey' is missing", LOG_WARNING);
|
||||
} else {
|
||||
// Old usage
|
||||
$label = $this->attribute_label[$key];
|
||||
$type = $this->attribute_type[$key];
|
||||
$size = $this->attribute_size[$key];
|
||||
$default = $this->attribute_default[$key];
|
||||
$computed = $this->attribute_computed[$key];
|
||||
$unique = $this->attribute_unique[$key];
|
||||
$required = $this->attribute_required[$key];
|
||||
$param = $this->attribute_param[$key];
|
||||
$perms = dol_eval($this->attribute_perms[$key], 1);
|
||||
$langfile = $this->attribute_langfile[$key];
|
||||
$list = dol_eval($this->attribute_list[$key], 1);
|
||||
$help = ''; // Not supported with old syntax
|
||||
$hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
||||
}
|
||||
|
||||
@ -230,7 +230,8 @@ class HookManager
|
||||
'setContentSecurityPolicy',
|
||||
'setHtmlTitle',
|
||||
'completeTabsHead',
|
||||
'formDolBanner'
|
||||
'formDolBanner',
|
||||
'displayMarginInfos',
|
||||
)
|
||||
)) {
|
||||
$hooktype = 'addreplace';
|
||||
|
||||
@ -2414,7 +2414,7 @@ class Form
|
||||
}
|
||||
}
|
||||
|
||||
$selectFields = " p.rowid, p.ref, p.label, p.description, p.barcode, p.fk_country, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.fk_price_expression";
|
||||
$selectFields = " p.rowid, p.ref, p.label, p.description, p.barcode, p.fk_country, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.default_vat_code, p.duration, p.fk_price_expression";
|
||||
if (count($warehouseStatusArray)) {
|
||||
$selectFieldsGrouped = ", sum(".$this->db->ifsql("e.statut IS NULL", "0", "ps.reel").") as stock"; // e.statut is null if there is no record in stock
|
||||
} else {
|
||||
@ -2436,8 +2436,8 @@ class Form
|
||||
//Price by customer
|
||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
|
||||
$sql .= ', pcp.rowid as idprodcustprice, pcp.price as custprice, pcp.price_ttc as custprice_ttc,';
|
||||
$sql .= ' pcp.price_base_type as custprice_base_type, pcp.tva_tx as custtva_tx, pcp.ref_customer as custref';
|
||||
$selectFields .= ", idprodcustprice, custprice, custprice_ttc, custprice_base_type, custtva_tx, custref";
|
||||
$sql .= ' pcp.price_base_type as custprice_base_type, pcp.tva_tx as custtva_tx, pcp.default_vat_code as custdefault_vat_code, pcp.ref_customer as custref';
|
||||
$selectFields .= ", idprodcustprice, custprice, custprice_ttc, custprice_base_type, custtva_tx, custdefault_vat_code, custref";
|
||||
}
|
||||
// Units
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
@ -2658,6 +2658,9 @@ class Form
|
||||
$objp->remise_percent = $objp2->remise_percent;
|
||||
$objp->remise = $objp2->remise;
|
||||
|
||||
//$objp->tva_tx is not overwritten by $objp2 value
|
||||
//$objp->default_vat_code is not overwritten by $objp2 value
|
||||
|
||||
$this->constructProductListOption($objp, $opt, $optJson, 0, $selected, $hidepriceinlabel, $filterkey);
|
||||
|
||||
$j++;
|
||||
@ -2709,8 +2712,9 @@ class Form
|
||||
}
|
||||
|
||||
/**
|
||||
* constructProductListOption.
|
||||
* Function to forge the string with OPTIONs of SELECT.
|
||||
* This define value for &$opt and &$optJson.
|
||||
* This function is called by select_produits_list().
|
||||
*
|
||||
* @param resource $objp Resultset of fetch
|
||||
* @param string $opt Option (var used for returned value in string option format)
|
||||
@ -2740,6 +2744,7 @@ class Form
|
||||
$outprice_ttc = '';
|
||||
$outpricebasetype = '';
|
||||
$outtva_tx = '';
|
||||
$outdefault_vat_code = '';
|
||||
$outqty = 1;
|
||||
$outdiscount = 0;
|
||||
|
||||
@ -2866,9 +2871,9 @@ class Form
|
||||
$found = 0;
|
||||
|
||||
// Multiprice
|
||||
// If we need a particular price level (from 1 to 6)
|
||||
// If we need a particular price level (from 1 to n)
|
||||
if (empty($hidepriceinlabel) && $price_level >= 1 && (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) {
|
||||
$sql = "SELECT price, price_ttc, price_base_type, tva_tx";
|
||||
$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_price";
|
||||
$sql .= " WHERE fk_product = ".((int) $objp->rowid);
|
||||
$sql .= " AND entity IN (".getEntity('productprice').")";
|
||||
@ -2892,7 +2897,13 @@ class Form
|
||||
$outprice_ht = price($objp2->price);
|
||||
$outprice_ttc = price($objp2->price_ttc);
|
||||
$outpricebasetype = $objp2->price_base_type;
|
||||
$outtva_tx = $objp2->tva_tx;
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { // using this option is a bug. kept for backward compatibility
|
||||
$outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice
|
||||
$outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice
|
||||
} else {
|
||||
$outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice
|
||||
$outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
@ -2919,7 +2930,8 @@ class Form
|
||||
$outprice_ht = price($objp->unitprice);
|
||||
$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100)));
|
||||
$outpricebasetype = $objp->price_base_type;
|
||||
$outtva_tx = $objp->tva_tx;
|
||||
$outtva_tx = $objp->tva_tx; // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty
|
||||
$outdefault_vat_code = $objp->default_vat_code; // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty
|
||||
}
|
||||
if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) {
|
||||
$opt .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
|
||||
@ -2947,6 +2959,7 @@ class Form
|
||||
$outprice_ttc = price($objp->custprice_ttc);
|
||||
$outpricebasetype = $objp->custprice_base_type;
|
||||
$outtva_tx = $objp->custtva_tx;
|
||||
$outdefault_vat_code = $objp->custdefault_vat_code;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2963,6 +2976,7 @@ class Form
|
||||
$outprice_ttc = price($objp->price_ttc);
|
||||
$outpricebasetype = $objp->price_base_type;
|
||||
$outtva_tx = $objp->tva_tx;
|
||||
$outdefault_vat_code = $objp->default_vat_code;
|
||||
}
|
||||
|
||||
if (!empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
|
||||
@ -3011,7 +3025,9 @@ class Form
|
||||
'price_ht'=>price2num($outprice_ht),
|
||||
'price_ttc'=>price2num($outprice_ttc),
|
||||
'pricebasetype'=>$outpricebasetype,
|
||||
'tva_tx'=>$outtva_tx, 'qty'=>$outqty,
|
||||
'tva_tx'=>$outtva_tx,
|
||||
'default_vat_code'=>$outdefault_vat_code,
|
||||
'qty'=>$outqty,
|
||||
'discount'=>$outdiscount,
|
||||
'duration_value'=>$outdurationvalue,
|
||||
'duration_unit'=>$outdurationunit,
|
||||
|
||||
@ -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.'&entity='.$entity.'&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";
|
||||
|
||||
201
htdocs/core/class/html.formldap.class.php
Normal file
201
htdocs/core/class/html.formldap.class.php
Normal 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);
|
||||
}
|
||||
}
|
||||
@ -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>';
|
||||
}
|
||||
}
|
||||
|
||||
926
htdocs/core/class/html.formsetup.class.php
Normal file
926
htdocs/core/class/html.formsetup.class.php
Normal 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.= ' '.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(' >> ', '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;
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
|
||||
@ -636,7 +636,6 @@ class Utils
|
||||
$execmethod = 1;
|
||||
}
|
||||
//$execmethod=1;
|
||||
|
||||
dol_syslog("Utils::executeCLI execmethod=".$execmethod." system:".$command, LOG_DEBUG);
|
||||
$output_arr = array();
|
||||
|
||||
|
||||
@ -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)';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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").' "'.dol_escape_htmltag(strtr($helppage,'_',' ')).'"';
|
||||
$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.='">';
|
||||
|
||||
@ -637,8 +637,9 @@ function modules_prepare_head($nbofactivatedmodules, $nboftotalmodules)
|
||||
$mode = empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ? 'commonkanban' : 'common';
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$mode;
|
||||
if ($nbofactivatedmodules <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only minimal initial modules enabled)
|
||||
$head[$h][1] = $form->textwithpicto($langs->trans("AvailableModules"), $desc);
|
||||
$head[$h][1] .= img_warning($langs->trans("YouMustEnableOneModule"));
|
||||
//$head[$h][1] = $form->textwithpicto($langs->trans("AvailableModules"), $desc);
|
||||
$head[$h][1] = $langs->trans("AvailableModules");
|
||||
$head[$h][1] .= $form->textwithpicto('', $langs->trans("YouMustEnableOneModule").'.<br><br><span class="opacitymedium">'.$desc.'</span>', 1, warning);
|
||||
} else {
|
||||
//$head[$h][1] = $langs->trans("AvailableModules").$form->textwithpicto('<span class="badge marginleftonly">'.$nbofactivatedmodules.' / '.$nboftotalmodules.'</span>', $desc, 1, 'help', '', 1, 3);
|
||||
$head[$h][1] = $langs->trans("AvailableModules").'<span class="badge marginleftonly">'.$nbofactivatedmodules.' / '.$nboftotalmodules.'</span>';
|
||||
|
||||
@ -274,6 +274,7 @@ function societe_prepare_head(Societe $object)
|
||||
|
||||
if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'thirdparty') {
|
||||
if (!empty($user->rights->partnership->read)) {
|
||||
$langs->load("partnership");
|
||||
$nbPartnership = is_array($object->partnerships) ? count($object->partnerships) : 0;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/partnership.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Partnership");
|
||||
@ -295,7 +296,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);
|
||||
|
||||
@ -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>';
|
||||
|
||||
|
||||
@ -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">';
|
||||
|
||||
@ -2004,11 +2004,15 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring
|
||||
// Skip directories (they would be added automatically)
|
||||
if (!$file->isDir()) {
|
||||
// Get real and relative path for current file
|
||||
$filePath = $file->getRealPath();
|
||||
$relativePath = substr($filePath, strlen($rootPath) + 1);
|
||||
$filePath = $file->getPath(); // the full path with filename using the $inputdir root.
|
||||
$fileName = $file->getFilename();
|
||||
$fileFullRealPath = $file->getRealPath(); // the full path with name and transformed to use real path directory.
|
||||
|
||||
//$relativePath = substr($fileFullRealPath, strlen($rootPath) + 1);
|
||||
$relativePath = substr(($filePath ? $filePath.'/' : '').$fileName, strlen($rootPath) + 1);
|
||||
|
||||
// Add current file to archive
|
||||
$zip->addFile($filePath, $relativePath);
|
||||
$zip->addFile($fileFullRealPath, $relativePath);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2196,22 +2200,29 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles =
|
||||
}
|
||||
|
||||
// Create recursive directory iterator
|
||||
// This does not return symbolic links
|
||||
/** @var SplFileInfo[] $files */
|
||||
$files = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($inputdir),
|
||||
RecursiveIteratorIterator::LEAVES_ONLY
|
||||
);
|
||||
|
||||
//var_dump($inputdir);
|
||||
foreach ($files as $name => $file) {
|
||||
// Skip directories (they would be added automatically)
|
||||
if (!$file->isDir()) {
|
||||
// Get real and relative path for current file
|
||||
$filePath = $file->getRealPath();
|
||||
$relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr($filePath, strlen($inputdir) + 1);
|
||||
$filePath = $file->getPath(); // the full path with filename using the $inputdir root.
|
||||
$fileName = $file->getFilename();
|
||||
$fileFullRealPath = $file->getRealPath(); // the full path with name and transformed to use real path directory.
|
||||
|
||||
if (empty($excludefiles) || !preg_match($excludefiles, $filePath)) {
|
||||
//$relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr($fileFullRealPath, strlen($inputdir) + 1);
|
||||
$relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr(($filePath ? $filePath.'/' : '').$fileName, strlen($inputdir) + 1);
|
||||
|
||||
//var_dump($filePath);var_dump($fileFullRealPath);var_dump($relativePath);
|
||||
if (empty($excludefiles) || !preg_match($excludefiles, $fileFullRealPath)) {
|
||||
// Add current file to archive
|
||||
$zip->addFile($filePath, $relativePath);
|
||||
$zip->addFile($fileFullRealPath, $relativePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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++;
|
||||
}
|
||||
|
||||
@ -835,7 +835,7 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
|
||||
|
||||
$out = dol_string_onlythesehtmltags($out, 0, 1, 1);
|
||||
|
||||
// We should also exclude non expected attributes
|
||||
// We should also exclude non expected HTML attributes and clean content of some attributes.
|
||||
if (!empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)) {
|
||||
// Warning, the function may add a LF so we are forced to trim to compare with old $out without having always a difference and an infinit loop.
|
||||
$out = trim(dol_string_onlythesehtmlattributes($out));
|
||||
@ -2887,7 +2887,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
|
||||
} else {
|
||||
if (!empty($dictsocialnetworks[$type]['url'])) {
|
||||
$link = str_replace('{socialid}', $value, $dictsocialnetworks[$type]['url']);
|
||||
$htmllink .= ' <a href="'.$link.'" target="_blank">'.$value.'</a>';
|
||||
$htmllink .= ' <a href="'.$link.'" target="_blank" rel="noopener noreferrer">'.$value.'</a>';
|
||||
} else {
|
||||
$htmllink .= $value;
|
||||
}
|
||||
@ -3140,7 +3140,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
|
||||
// Old method
|
||||
$newphone = '<a href="'.$url.'"';
|
||||
if (!empty($conf->global->CLICKTODIAL_FORCENEWTARGET)) {
|
||||
$newphone .= ' target="_blank"';
|
||||
$newphone .= ' target="_blank" rel="noopener noreferrer"';
|
||||
}
|
||||
$newphone .= '>'.$newphonesav.'</a>';
|
||||
}
|
||||
@ -3632,7 +3632,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cubes',
|
||||
'multicurrency',
|
||||
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'dynamicprice',
|
||||
'edit', 'ellipsis-h', 'email', 'eraser', 'establishment', 'expensereport', 'external-link-alt', 'external-link-square-alt',
|
||||
'edit', 'ellipsis-h', 'email', 'entity', 'eraser', 'establishment', 'expensereport', 'external-link-alt', 'external-link-square-alt',
|
||||
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus',
|
||||
'generate', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group',
|
||||
'help', 'holiday',
|
||||
@ -3649,7 +3649,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'salary', 'shipment', 'state', 'supplier_invoice', 'supplier_invoicea', 'supplier_invoicer', 'supplier_invoiced',
|
||||
'technic', 'ticket',
|
||||
'error', 'warning',
|
||||
'recent', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'resource',
|
||||
'recent', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'resource', 'recurring',
|
||||
'shapes', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice',
|
||||
'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda',
|
||||
'uncheck', 'user-cog', 'vat', 'website', 'workstation',
|
||||
@ -3678,8 +3678,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'accounting'=>'search-dollar', 'category'=>'tag', 'dollyrevert'=>'dolly',
|
||||
'generate'=>'plus-square', 'hrm'=>'user-tie', 'incoterm'=>'truck-loading',
|
||||
'margin'=>'calculator', 'members'=>'user-friends', 'ticket'=>'ticket-alt', 'globe'=>'external-link-alt', 'lot'=>'barcode',
|
||||
'email'=>'at', 'establishment'=>'building',
|
||||
'edit'=>'pencil-alt', 'graph'=>'chart-line', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'question-circle',
|
||||
'email'=>'at', 'establishment'=>'building', 'edit'=>'pencil-alt', 'entity'=>'globe',
|
||||
'graph'=>'chart-line', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'question-circle',
|
||||
'generic'=>'file', 'holiday'=>'umbrella-beach',
|
||||
'info'=>'info-circle', 'inventory'=>'boxes', 'intracommreport'=>'globe-europe', 'knowledgemanagement'=>'ticket-alt', 'label'=>'layer-group', 'loan'=>'money-bill-alt',
|
||||
'member'=>'user-alt', 'meeting'=>'chalkboard-teacher', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right',
|
||||
@ -3695,7 +3695,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'partnership'=>'handshake', 'payment'=>'money-check-alt', 'payment_vat'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell',
|
||||
'recent' => 'question', 'reception'=>'dolly', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge',
|
||||
'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature',
|
||||
'refresh'=>'redo', 'region'=>'map-marked', 'resource'=>'laptop-house',
|
||||
'refresh'=>'redo', 'region'=>'map-marked', 'resource'=>'laptop-house', 'recurring'=>'history',
|
||||
'state'=>'map-marked-alt', 'security'=>'key', 'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s',
|
||||
'supplier'=>'building', 'technic'=>'cogs',
|
||||
'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach',
|
||||
@ -6476,9 +6476,27 @@ function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes
|
||||
if (is_object($dom)) {
|
||||
for ($els = $dom->getElementsByTagname('*'), $i = $els->length - 1; $i >= 0; $i--) {
|
||||
for ($attrs = $els->item($i)->attributes, $ii = $attrs->length - 1; $ii >= 0; $ii--) {
|
||||
// Delete attribute if not into allowed_attributes
|
||||
if (! empty($attrs->item($ii)->name) && ! in_array($attrs->item($ii)->name, $allowed_attributes)) {
|
||||
$els->item($i)->removeAttribute($attrs->item($ii)->name);
|
||||
//var_dump($attrs->item($ii));
|
||||
if (! empty($attrs->item($ii)->name)) {
|
||||
// Delete attribute if not into allowed_attributes
|
||||
if (! in_array($attrs->item($ii)->name, $allowed_attributes)) {
|
||||
$els->item($i)->removeAttribute($attrs->item($ii)->name);
|
||||
} elseif (in_array($attrs->item($ii)->name, array('style'))) {
|
||||
$valuetoclean = $attrs->item($ii)->value;
|
||||
|
||||
do {
|
||||
$oldvaluetoclean = $valuetoclean;
|
||||
$valuetoclean = preg_replace('/\/\*.*\*\//m', '', $valuetoclean); // clean css comments
|
||||
$valuetoclean = preg_replace('/position\s*:\s*[a-z]+/mi', '', $valuetoclean);
|
||||
if ($els->item($i)->tagName == 'a') { // more paranoiac cleaning for clickable tags.
|
||||
$valuetoclean = preg_replace('/display\s*://m', '', $valuetoclean);
|
||||
$valuetoclean = preg_replace('/z-index\s*://m', '', $valuetoclean);
|
||||
$valuetoclean = preg_replace('/\s+(top|left|right|bottom)\s*://m', '', $valuetoclean);
|
||||
}
|
||||
} while ($oldvaluetoclean != $valuetoclean);
|
||||
|
||||
$attrs->item($ii)->value = $valuetoclean;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8132,10 +8150,10 @@ function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid =
|
||||
/**
|
||||
* Verify if condition in string is ok or not
|
||||
*
|
||||
* @param string $strRights String with condition to check
|
||||
* @return boolean True or False. Return True if strRights is ''
|
||||
* @param string $strToEvaluate String with condition to check
|
||||
* @return boolean True or False. Note: It returns True if $strToEvaluate is ''
|
||||
*/
|
||||
function verifCond($strRights)
|
||||
function verifCond($strToEvaluate)
|
||||
{
|
||||
global $user, $conf, $langs;
|
||||
global $leftmenu;
|
||||
@ -8143,8 +8161,8 @@ function verifCond($strRights)
|
||||
|
||||
//print $strRights."<br>\n";
|
||||
$rights = true;
|
||||
if ($strRights != '') {
|
||||
$str = 'if(!('.$strRights.')) { $rights = false; }';
|
||||
if ($strToEvaluate !== '') {
|
||||
$str = 'if(!('.$strToEvaluate.')) { $rights = false; }';
|
||||
dol_eval($str); // The dol_eval must contains all the global $xxx used into a condition
|
||||
}
|
||||
return $rights;
|
||||
@ -9157,9 +9175,9 @@ function ajax_autoselect($htmlname, $addlink = '', $textonlink = 'Link')
|
||||
</script>';
|
||||
if ($addlink) {
|
||||
if ($textonlink === 'image') {
|
||||
$out .= ' <a href="'.$addlink.'" target="_blank">'.img_picto('', 'globe').'</a>';
|
||||
$out .= ' <a href="'.$addlink.'" target="_blank" rel="noopener noreferrer">'.img_picto('', 'globe').'</a>';
|
||||
} else {
|
||||
$out .= ' <a href="'.$addlink.'" target="_blank">'.$langs->trans("Link").'</a>';
|
||||
$out .= ' <a href="'.$addlink.'" target="_blank" rel="noopener noreferrer">'.$langs->trans("Link").'</a>';
|
||||
}
|
||||
}
|
||||
return $out;
|
||||
|
||||
@ -2131,30 +2131,38 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '')
|
||||
|
||||
// Special cases, to work with non standard path
|
||||
if ($objecttype == 'facture' || $objecttype == 'invoice') {
|
||||
$langs->load('bills');
|
||||
$classpath = 'compta/facture/class';
|
||||
$module = 'facture';
|
||||
$myobject = 'facture';
|
||||
} elseif ($objecttype == 'commande' || $objecttype == 'order') {
|
||||
$langs->load('orders');
|
||||
$classpath = 'commande/class';
|
||||
$module = 'commande';
|
||||
$myobject = 'commande';
|
||||
} elseif ($objecttype == 'propal') {
|
||||
$langs->load('propal');
|
||||
$classpath = 'comm/propal/class';
|
||||
} elseif ($objecttype == 'supplier_proposal') {
|
||||
$langs->load('supplier_proposal');
|
||||
$classpath = 'supplier_proposal/class';
|
||||
} elseif ($objecttype == 'shipping') {
|
||||
$langs->load('sendings');
|
||||
$classpath = 'expedition/class';
|
||||
$myobject = 'expedition';
|
||||
$module = 'expedition_bon';
|
||||
} elseif ($objecttype == 'delivery') {
|
||||
$langs->load('deliveries');
|
||||
$classpath = 'delivery/class';
|
||||
$myobject = 'delivery';
|
||||
$module = 'delivery_note';
|
||||
} elseif ($objecttype == 'contract') {
|
||||
$langs->load('contracts');
|
||||
$classpath = 'contrat/class';
|
||||
$module = 'contrat';
|
||||
$myobject = 'contrat';
|
||||
} elseif ($objecttype == 'member') {
|
||||
$langs->load('members');
|
||||
$classpath = 'adherents/class';
|
||||
$module = 'adherent';
|
||||
$myobject = 'adherent';
|
||||
@ -2163,13 +2171,16 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '')
|
||||
$module = 'cabinetmed';
|
||||
$myobject = 'cabinetmedcons';
|
||||
} elseif ($objecttype == 'fichinter') {
|
||||
$langs->load('interventions');
|
||||
$classpath = 'fichinter/class';
|
||||
$module = 'ficheinter';
|
||||
$myobject = 'fichinter';
|
||||
} elseif ($objecttype == 'project') {
|
||||
$langs->load('projects');
|
||||
$classpath = 'projet/class';
|
||||
$module = 'projet';
|
||||
} elseif ($objecttype == 'task') {
|
||||
$langs->load('projects');
|
||||
$classpath = 'projet/class';
|
||||
$module = 'projet';
|
||||
$myobject = 'task';
|
||||
|
||||
@ -93,7 +93,7 @@ function dol_setcache($memoryid, $data, $expire = 0)
|
||||
$dolmemcache->add($memoryid, $data, $expire); // This fails if key already exists
|
||||
$rescode = $dolmemcache->getResultCode();
|
||||
if ($rescode == 0) {
|
||||
return is_countable($data) ? count($data) : 0;
|
||||
return is_array($data) ? count($data) : 0;
|
||||
} else {
|
||||
return -$rescode;
|
||||
}
|
||||
@ -113,7 +113,7 @@ function dol_setcache($memoryid, $data, $expire = 0)
|
||||
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
|
||||
$result = $dolmemcache->add($memoryid, $data, false, $expire); // This fails if key already exists
|
||||
if ($result) {
|
||||
return is_countable($data) ? count($data) : 0;
|
||||
return is_array($data) ? count($data) : 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user