diff --git a/ChangeLog b/ChangeLog
index 5b73c4b2212..f5449fa601b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,7 +19,8 @@ WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The ICS value for direct debit or credit transfer is now store on each bank account instead of into the global setup.
* API /setup/shipment_methods has been replaced with API /setup/shipping_methods
-
+* Field "tva" renamed into to "total_tva" in llx_propal, llx_supplier_proposal, llx_commande for better field name consistency
+* Field "total" renamed into "total_ttc" in llx_supplier_proposal for better field name consistency
***** ChangeLog for 13.0.1 compared to 13.0.0 *****
@@ -41,6 +42,7 @@ FIX: #16135
FIX: #16143
FIX: #16156
FIX: #16160
+FIX: #16165 Create customer discount without vat
FIX: #16185
FIX: #16189, fix download/see check deposit PDF
FIX: #16215
@@ -75,6 +77,7 @@ FIX: ODT generation very slow
FIX: amount in summary of report
FIX: vat value when code contains number
FIX: payment term label on PDF
+FIX: date selector when using reduced year (like on smartphone)
***** ChangeLog for 13.0.0 compared to 12.0.0 *****
@@ -325,6 +328,63 @@ Following changes may create regressions for some external modules, but were nec
* Dolibarr v13 is still compatible with any PHP version between 5.6.0 and 7.4.*; Unit tests are OK with PHP 8.0 but some warnings or troubles may appears with PHP 8.0.
* All your Ajax services must contains such a line at begin of file: if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
+
+
+***** ChangeLog for 12.0.5 compared to 12.0.4 *****
+FIX: before crediting a withdrawal receipt, check whether it has been credited already
+FIX: mandatory extrafields of type sellist
+FIX: when a mandatory extrafield of type sellist contains '0' it should be considered empty and trigger an error message upon insertion
+FIX: when a new intervention is created from an object, a new $extrafields object is instantiated but not initialized
+FIX: "openall" filter on ticket list does not include read tickets
+FIX: ticket - extrafields of type 'date' are not saved
+FIX: ticket - the "openall" filter on the ticket list does not include tickets with status READ
+FIX: #14290 #15900
+FIX: #15388 #15891
+FIX: #15465 External user sees last 5 shipments to other customers in the dashboard
+FIX: #15629
+FIX: #15751 Miscellaneous payment type change to 0 after updating subledger account
+FIX: #15946
+FIX: #15966 #15967
+FIX: Accountancy - Fix some problems on CEGID export
+FIX: Accountancy - label_operation is used instead of label_compte
+FIX: Accountancy - Retire entire opening balance feature
+FIX: add autofix of count of email target when data is corrupted
+FIX: add categories params on llxHeader filter
+FIX: Add critical price patch from 12 to 11.
+FIX: Bad cleaning of VAT rate when numbers are into code
+FIX: Bad dates filtering in the ticket list causes sql error
+FIX: balance starting and ending fiscal month #14197
+FIX: bom line unit display #13831
+FIX: cash fence for takepos with multientity
+FIX: Check of customer/vendor code fails in some cases
+FIX: create ticket : thirdparty/contact notification #15629
+FIX: Creation of thirdparty when setup is empty
+FIX: Dates of sales start in TakePOS
+FIX: dupliacete customer or supplier code must be error dipslayed with new code proposed
+FIX: Export FEC - Force Carriage Return Line Feed
+FIX: Facture Situation Out : status condition
+FIX: Filter on date of next generation on template invoices
+FIX: Fix detect dispatched product and set to received completely when the supplier order have services (support STOCK_SUPPORTS_SERVICES)
+FIX: Invoice Situation Out : status condition
+FIX: issue 15659 : Missing test if supplier conf is enabled
+FIX: link to create event when task is in a project with a thirdparty
+FIX: Localtax must be converted with price2num
+FIX: manage price min for PRODUIT_CUSTOMER_PRICES
+FIX: missing GETPOST parameters on card_presend.tpl.php
+FIX: missing socid into link to create event from project agenda tab
+FIX: Must delete extrafields before main table on product deletion.
+FIX: (path) htdocs removed
+FIX: php alert sms.php
+FIX: right to show VAT rate in product list
+FIX: select default mail template
+FIX: Timeout during import
+FIX: update order by api
+FIX: useless tracking number displayed on pdf if empty issue #14501
+FIX: Visible date of payment
+FIX: warning when adding a line if $remise_percent is an empty string
+FIX: When creating a new POS sell, the creation date must be modified.
+FIX: wrong name for search status param issue #15516
+
***** ChangeLog for 12.0.4 compared to 12.0.3 *****
FIX: make formConfirm an addreplace-type hook
FIX: regex to remove 'action' parameter: taking feedback from PR#15213 into account
diff --git a/SECURITY.md b/SECURITY.md
index 08ca64e4a4c..f63f9c3f277 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -12,7 +12,7 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
## Reporting a Vulnerability
-To report a vulnerability, please use GitHub security advisory (alternatively send an email to security@dolibarr.org)
+To report a vulnerability, please use GitHub security advisory at https://github.com/Dolibarr/dolibarr/security/advisories/new (or alternatively send an email to security@dolibarr.org)
## Hunting vulnerabilities on Dolibarr
diff --git a/doc/images/dolibarr_screenshot12_1920x1080.jpg b/doc/images/dolibarr_screenshot12_1920x1080.jpg
new file mode 100644
index 00000000000..72ae74cb00f
Binary files /dev/null and b/doc/images/dolibarr_screenshot12_1920x1080.jpg differ
diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php
index 969bf3a8906..35ce841ba6e 100644
--- a/htdocs/adherents/document.php
+++ b/htdocs/adherents/document.php
@@ -73,7 +73,7 @@ $upload_dir = $conf->adherent->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'me
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php
index 008e5277bc3..ec93c95b045 100644
--- a/htdocs/admin/pdf.php
+++ b/htdocs/admin/pdf.php
@@ -326,7 +326,8 @@ print '';
print '
'.$langs->trans("PDF_USE_ALSO_LANGUAGE_CODE").' ';
//if (! empty($conf->global->MAIN_MULTILANGS))
//{
-print $formadmin->select_language(GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) ? $conf->global->PDF_USE_ALSO_LANGUAGE_CODE : 0), 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1);
+$selected = GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) ? $conf->global->PDF_USE_ALSO_LANGUAGE_CODE : 0);
+print $formadmin->select_language($selected, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1);
//} else {
// print ''.$langs->trans("MultiLangNotEnabled").' ';
//}
diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php
index 2b3bb6e8d21..46ed0c75934 100644
--- a/htdocs/admin/system/dolibarr.php
+++ b/htdocs/admin/system/dolibarr.php
@@ -120,7 +120,7 @@ if (function_exists('curl_init'))
print $langs->trans("LastStableVersion").' : '.$langs->trans("UpdateServerOffline").' ';
}
} else {
- print $langs->trans("LastStableVersion").' : '.$langs->trans("Check").' ';
+ print $langs->trans("LastStableVersion").' : '.$langs->trans("Check").' ';
}
}
diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php
index 58307781cf2..96cb7baff73 100644
--- a/htdocs/asset/card.php
+++ b/htdocs/asset/card.php
@@ -125,38 +125,18 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
}
-
-
-
/*
* View
*
- * Put here all code to build page
*/
$form = new Form($db);
$formfile = new FormFile($db);
-$title = $langs->trans("Assets").' - '.$langs->trans("Card");
+$title = $langs->trans("Asset").' - '.$langs->trans("Card");
$help_url = '';
llxHeader('', $title, $help_url);
-// Example : Adding jquery code
-print '';
-
-
// Part to create
if ($action == 'create')
{
@@ -240,14 +220,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Confirmation to delete
if ($action == 'delete')
{
- $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteAssets'), $langs->trans('ConfirmDeleteAssets'), 'confirm_delete', '', 0, 1);
- }
-
- // Confirmation of action xxxx
- if ($action == 'xxx')
- {
- $formquestion = array();
- $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteAssets'), $langs->trans('ConfirmDeleteAsset'), 'confirm_delete', '', 0, 1);
}
// Call Hook formConfirm
@@ -292,28 +265,24 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '';
print '';
- print '';
- print '';
print '
';
print dol_get_fiche_end();
- // Buttons for actions
- if ($action != 'presend' && $action != 'editline') {
- print ''."\n";
+ /*
+ * Buttons
+ */
+ if ($user->socid == 0)
+ {
+ print '
'."\n";
- }
-
-
- // Select mail models is same action as presend
- if (GETPOST('modelselected')) {
- $action = 'presend';
+ print "
";
}
if ($action != 'presend')
@@ -343,27 +306,23 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print ' '; // ancre
// Documents
- /*$objref = dol_sanitizeFileName($object->ref);
- $relativepath = $comref . '/' . $comref . '.pdf';
- $filedir = $conf->asset->dir_output . '/' . $objref;
- $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
+ $filename = dol_sanitizeFileName($object->ref);
+ $filedir = $conf->contrat->dir_output."/".dol_sanitizeFileName($object->ref);
+ $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $user->rights->asset->read; // If you can read, you can build the PDF to read content
- $delallowed = $user->rights->asset->create; // If you can create/edit, you can remove a file on card
- print $formfile->showdocuments('asset', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
- */
+ $delallowed = $user->rights->asset->write; // If you can create/edit, you can remove a file on card
+
+ print $formfile->showdocuments('asset', $filename, $filedir, $urlsource, 0, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('asset'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
-
print '';
$MAXEVENT = 10;
- $morehtmlright = '
';
- $morehtmlright .= $langs->trans("SeeAll");
- $morehtmlright .= ' ';
+ $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/asset/info.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
@@ -372,19 +331,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '
';
}
-
- //Select mail models is same action as presend
- if (GETPOST('modelselected')) $action = 'presend';
-
- // Presend form
- /*
- $modelmail='asset';
- $defaulttopic='InformationMessage';
- $diroutput = $conf->asset->dir_output.'/asset';
- $trackid = 'asset'.$object->id;
-
- include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
- */
}
diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php
index 4c2e36aed9a..32a4163dd12 100644
--- a/htdocs/asset/document.php
+++ b/htdocs/asset/document.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2018 Alexandre Spangaro
+ * Copyright (C) 2018-2021 Alexandre Spangaro
*
* 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
@@ -19,7 +19,7 @@
/**
* \file htdocs/asset/document.php
* \ingroup asset
- * \brief Tab for documents linked to Assets
+ * \brief Page for attached files on assets
*/
require '../main.inc.php';
@@ -31,18 +31,21 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
// Load translation files required by the page
-$langs->loadLangs(array("assets", "companies"));
+$langs->loadLangs(array('assets', 'companies', 'other'));
-$action = GETPOST('action', 'aZ09');
-$confirm = GETPOST('confirm');
-$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
+$id = (GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
$ref = GETPOST('ref', 'alpha');
+$socid = GETPOST('socid', 'int');
+$action = GETPOST('action', 'aZ09');
+$confirm = GETPOST('confirm', 'alpha');
-// Security check - Protection if external user
-//if ($user->socid > 0) accessforbidden();
-//if ($user->socid > 0) $socid = $user->socid;
-//$result = restrictedArea($user, 'asset', $id);
+// Security check
+if ($user->socid)
+{
+ $socid = $user->socid;
+}
+$result=restrictedArea($user, 'asset', $id, '');
// Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
@@ -56,100 +59,79 @@ $pagenext = $page + 1;
if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "name";
-// Initialize technical objects
$object = new Asset($db);
-$extrafields = new ExtraFields($db);
-$diroutputmassaction = $conf->assets->dir_output.'/temp/massgeneration/'.$user->id;
-$hookmanager->initHooks(array('assetdocument')); // Note that conf->hooks_modules contains array
-
-// Fetch optionals attributes and labels
-$extrafields->fetch_name_optionals_label($object->table_element);
-
-// Load object
-include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
-
-// Security check
-if (!empty($user->socid)) $socid = $user->socid;
-$result = restrictedArea($user, 'asset', $id);
-
-//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/packages/" . dol_sanitizeFileName($object->id);
-if ($id > 0 || !empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity]."/packages/".dol_sanitizeFileName($object->ref);
-
+if ($object->fetch($id))
+{
+ $upload_dir = $conf->asset->dir_output."/".dol_sanitizeFileName($object->ref);
+}
/*
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
* View
*/
+$title = $langs->trans('Assets')." - ".$langs->trans('Documents');
+$helpurl = '';
+llxHeader('', $title, $helpurl);
+
$form = new Form($db);
-$title = $langs->trans("Assets").' - '.$langs->trans("Files");
-$help_url = '';
-//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
-llxHeader('', $title, $help_url);
-if ($object->id)
+
+if ($id > 0 || !empty($ref))
{
- /*
- * Show tabs
- */
- if (!empty($conf->notification->enabled)) $langs->load("mails");
- $head = asset_prepare_head($object);
-
- print dol_get_fiche_head($head, 'document', $langs->trans("Asset"), -1, 'generic');
-
-
- // Build file list
- $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
- $totalsize = 0;
- foreach ($filearray as $key => $file)
+ if ($object->fetch($id, $ref) > 0)
{
- $totalsize += $file['size'];
+ $upload_dir = $conf->asset->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
+
+ $head = asset_prepare_head($object);
+ print dol_get_fiche_head($head, 'documents', $langs->trans('Asset'), -1, 'accounting');
+
+ // Build file list
+ $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
+ $totalsize = 0;
+ foreach ($filearray as $key => $file)
+ {
+ $totalsize += $file['size'];
+ }
+
+ // Asset content
+
+ $linkback = ''.$langs->trans("BackToList").' ';
+
+ $morehtmlref = '';
+ dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
+
+ print '';
+ print '
';
+
+ print '
';
+
+ print ''.$langs->trans("NbOfAttachedFiles").' '.count($filearray).' ';
+ print ''.$langs->trans("TotalSizeOfAttachedFiles").' '.dol_print_size($totalsize, 1, 1).' ';
+ print "
\n";
+
+ print "
\n";
+
+ print dol_get_fiche_end();
+
+ $modulepart = 'asset';
+ $permission = $user->rights->asset->write;
+ $permtoedit = $user->rights->asset->write;
+ $param = '&id='.$object->id;
+ include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
+ } else {
+ dol_print_error($db);
}
-
- // Object card
- // ------------------------------------------------------------
- $linkback = ''.$langs->trans("BackToList").' ';
-
- dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
-
- print '';
-
- print '
';
- print '
';
-
- // Number of files
- print ''.$langs->trans("NbOfAttachedFiles").' '.count($filearray).' ';
-
- // Total size
- print ''.$langs->trans("TotalSizeOfAttachedFiles").' '.$totalsize.' '.$langs->trans("bytes").' ';
-
- print '
';
-
- print '
';
-
- print dol_get_fiche_end();
-
- $modulepart = 'asset';
- //$permission = $user->rights->asset->create;
- $permission = 1;
- //$permtoedit = $user->rights->asset->create;
- $permtoedit = 1;
- $param = '&id='.$object->id;
-
- //$relativepathwithnofile='asset/' . dol_sanitizeFileName($object->id).'/';
- $relativepathwithnofile = 'asset/'.dol_sanitizeFileName($object->ref).'/';
-
- include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {
- accessforbidden('', 0, 1);
+ print $langs->trans("ErrorUnknown");
}
// End of page
diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php
index fecebb676a8..38969d65182 100644
--- a/htdocs/asset/type.php
+++ b/htdocs/asset/type.php
@@ -157,7 +157,7 @@ if ($action == 'update' && $user->rights->asset->write)
if ($ret >= 0 && !count($object->errors))
{
- setEventMessages($langs->trans("AssetsTypeModified"), null, 'mesgs');
+ setEventMessages($langs->trans("AssetTypeModified"), null, 'mesgs');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php
index cf752878605..ddd9fe0eee6 100644
--- a/htdocs/bom/bom_document.php
+++ b/htdocs/bom/bom_document.php
@@ -76,7 +76,7 @@ if ($id > 0 || !empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index e34dffd6223..fba2cf10cbc 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -730,8 +730,8 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate')
{
$error = 0;
- $shour = dol_print_date($object->datep, "%H");
- $smin = dol_print_date($object->datep, "%M");
+ $shour = dol_print_date($object->datep, "%H", 'tzuserrel'); // We take the date visible by user $newdate is also date visible by user.
+ $smin = dol_print_date($object->datep, "%M", 'tzuserrel');
$newdate = GETPOST('newdate', 'alpha');
if (empty($newdate) || strpos($newdate, 'dayevent_') != 0)
@@ -740,7 +740,9 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate')
exit;
}
- $datep = dol_mktime($shour, $smin, 0, substr($newdate, 13, 2), substr($newdate, 15, 2), substr($newdate, 9, 4));
+ $datep = dol_mktime($shour, $smin, 0, substr($newdate, 13, 2), substr($newdate, 15, 2), substr($newdate, 9, 4), 'tzuserrel');
+ //print dol_print_date($datep, 'dayhour');exit;
+
if ($datep != $object->datep)
{
if (!empty($object->datef))
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index c2dc7f6b2a6..0aff54a93e3 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -85,6 +85,11 @@ class ActionComm extends CommonObject
*/
public $type_id;
+ /**
+ * @var string Calendar of event (Type of type of event). 'system'=Default calendar, 'systemauto'=Auto calendar, 'birthdate', 'holiday', 'module'=Calendar specific to a module
+ */
+ public $type;
+
/**
* @var string Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH.
*/
@@ -95,16 +100,16 @@ class ActionComm extends CommonObject
*/
public $type_label;
- /**
- * @var string Label into parent table llx_c_actioncomm (used only if option to use type is set)
- */
- public $type;
-
/**
* @var string Color into parent table llx_c_actioncomm (used only if option to use type is set)
*/
public $type_color;
+ /**
+ * @var string Picto for type of event (used only if option to use type is set)
+ */
+ public $type_picto;
+
/**
* @var string Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...)
*/
@@ -1376,7 +1381,7 @@ class ActionComm extends CommonObject
* @param int $maxlength Max number of charaters into label. If negative, use the ref as label.
* @param string $classname Force style class on a link
* @param string $option '' = Link to action, 'birthday'= Link to contact, 'holiday' = Link to leave
- * @param int $overwritepicto 1 = Overwrite picto
+ * @param int $overwritepicto 1 = Overwrite picto with this one
* @param int $notooltip 1 = Disable tooltip
* @param int $save_lastsearch_value -1 = Auto, 0 = No save of lastsearch_values when clicking, 1 = Save lastsearch_values whenclicking
* @return string Chaine avec URL
@@ -1426,8 +1431,8 @@ class ActionComm extends CommonObject
if (!empty($this->note_private))
$tooltip .= ''.$langs->trans('Note').': '.(dol_textishtml($this->note_private) ? str_replace(array("\r", "\n"), "", $this->note_private) : str_replace(array("\r", "\n"), ' ', $this->note_private));
$linkclose = '';
- if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
- $linkclose = ' style="background-color:#'.$this->type_color.'"';
+ //if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
+ // $linkclose = ' style="background-color:#'.$this->type_color.'"';
if (empty($notooltip))
{
@@ -1453,6 +1458,7 @@ class ActionComm extends CommonObject
elseif ($option == 'holiday')
$url = DOL_URL_ROOT.'/holiday/card.php?id='.$this->id;
else $url = DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id;
+
if ($option !== 'nolink')
{
// Add param to save lastsearch_values or not
@@ -1494,7 +1500,7 @@ class ActionComm extends CommonObject
}
$result .= $linkstart;
- if ($withpicto) $result .= img_object(($notooltip ? '' : $langs->trans("ShowAction").': '.$libelle), ($overwritepicto ? $overwritepicto : 'action'), ($notooltip ? 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"' : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ if ($withpicto) $result .= img_object(($notooltip ? '' : $langs->trans("ShowAction").': '.$libelle), ($overwritepicto ? $overwritepicto : 'action'), (($this->type_color && $overwritepicto) ? 'style="color: #'.$this->type_color.' !important;" ' : '').($notooltip ? 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"' : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
$result .= $libelleshort;
$result .= $linkend;
@@ -1520,21 +1526,25 @@ class ActionComm extends CommonObject
$imgpicto = '';
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
+ $color = '';
+ if ($this->type_color) {
+ $color = 'style="color: #'.$this->type_color.' !important;"';
+ }
if ($this->type_picto) {
$imgpicto = img_picto('', $this->type_picto, 'class="paddingright"');
} else {
- if ($this->type_code == 'AC_RDV') $imgpicto = img_picto('', 'meeting', '', false, 0, 0, '', 'paddingright');
- elseif ($this->type_code == 'AC_TEL') $imgpicto = img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright');
- elseif ($this->type_code == 'AC_FAX') $imgpicto = img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright');
- elseif ($this->type_code == 'AC_EMAIL' || $this->type_code == 'AC_EMAIL_IN') $imgpicto = img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright');
- elseif ($this->type_code == 'AC_INT') $imgpicto = img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright');
- elseif ($this->type_code == 'AC_OTH' && $this->code == 'TICKET_MSG') $imgpicto = img_picto('', 'object_conversation', '', false, 0, 0, '', 'paddingright');
- elseif (!preg_match('/_AUTO/', $this->type_code)) $imgpicto = img_picto('', 'user-cog', '', false, 0, 0, '', 'paddingright');
- else $imgpicto = img_picto('', 'cog', '', false, 0, 0, '', 'paddingright');
+ if ($this->type_code == 'AC_RDV') $imgpicto = img_picto('', 'meeting', $color, false, 0, 0, '', 'paddingright');
+ elseif ($this->type_code == 'AC_TEL') $imgpicto = img_picto('', 'object_phoning', $color, false, 0, 0, '', 'paddingright');
+ elseif ($this->type_code == 'AC_FAX') $imgpicto = img_picto('', 'object_phoning_fax', $color, false, 0, 0, '', 'paddingright');
+ elseif ($this->type_code == 'AC_EMAIL' || $this->type_code == 'AC_EMAIL_IN') $imgpicto = img_picto('', 'object_email', $color, false, 0, 0, '', 'paddingright');
+ elseif ($this->type_code == 'AC_INT') $imgpicto = img_picto('', 'object_intervention', $color, false, 0, 0, '', 'paddingright');
+ elseif ($this->type_code == 'AC_OTH' && $this->code == 'TICKET_MSG') $imgpicto = img_picto('', 'object_conversation', $color, false, 0, 0, '', 'paddingright');
+ elseif ($this->type != 'systemauto') $imgpicto = img_picto('', 'user-cog', $color, false, 0, 0, '', 'paddingright');
+ else $imgpicto = img_picto('', 'cog', $color, false, 0, 0, '', 'paddingright');
}
} else {
// 2 picto: 1 for auto, 1 for manual
- if (!preg_match('/_AUTO/', $this->type_code)) $imgpicto = img_picto('', 'user-cog', '', false, 0, 0, '', 'paddingright');
+ if ($this->type != 'systemauto') $imgpicto = img_picto('', 'user-cog', '', false, 0, 0, '', 'paddingright');
else $imgpicto = img_picto('', 'cog', '', false, 0, 0, '', 'paddingright');
}
return $imgpicto;
diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php
index 3b932b2f59c..6b02c026575 100644
--- a/htdocs/comm/action/class/cactioncomm.class.php
+++ b/htdocs/comm/action/class/cactioncomm.class.php
@@ -142,9 +142,9 @@ class CActionComm
* Return list of event types: array(id=>label) or array(code=>label)
*
* @param string|int $active 1 or 0 to filter on event state active or not ('' by default = no filter)
- * @param string $idorcode 'id' or 'code'
+ * @param string $idorcode 'id' or 'code' or 'all'
* @param string $excludetype Type to exclude ('system' or 'systemauto')
- * @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual"
+ * @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line per calendar (Default, Auto, BoothConf, ...)
* @param string $morefilter Add more SQL filter
* @param int $shortlabel 1=Get short label instead of long label
* @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode.
@@ -157,6 +157,7 @@ class CActionComm
$repid = array();
$repcode = array();
+ $repall = array();
$sql = "SELECT id, code, libelle as label, module, type, color, picto";
$sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm";
@@ -166,7 +167,7 @@ class CActionComm
}
if (!empty($excludetype)) $sql .= " AND type <> '".$this->db->escape($excludetype)."'";
if ($morefilter) $sql .= " AND ".$morefilter;
- $sql .= " ORDER BY module, position, type";
+ $sql .= " ORDER BY type, position, module";
dol_syslog(get_class($this)."::liste_array", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -175,6 +176,7 @@ class CActionComm
$nump = $this->db->num_rows($resql);
if ($nump)
{
+ $idforallfornewmodule = 97;
$i = 0;
while ($i < $nump)
{
@@ -200,8 +202,12 @@ class CActionComm
$keyfortrans = '';
$transcode = '';
$code = $obj->code;
- if ($onlyautoornot > 0 && $code == 'AC_OTH') $code = 'AC_MANUAL';
- if ($onlyautoornot > 0 && $code == 'AC_OTH_AUTO') $code = 'AC_AUTO';
+ $typecalendar = $obj->type;
+
+ if ($onlyautoornot > 0 && $typecalendar == 'system') $code = 'AC_MANUAL';
+ elseif ($onlyautoornot > 0 && $typecalendar == 'systemauto') $code = 'AC_AUTO';
+ elseif ($onlyautoornot > 0) $code = 'AC_'.strtoupper($obj->module);
+
if ($shortlabel)
{
$keyfortrans = "Action".$code.'Short';
@@ -213,21 +219,43 @@ class CActionComm
$transcode = $langs->trans($keyfortrans);
}
$label = (($transcode != $keyfortrans) ? $transcode : $langs->trans($obj->label));
- if ($onlyautoornot == -1 && !empty($conf->global->AGENDA_USE_EVENT_TYPE) && !preg_match('/auto/i', $code))
+ if ($onlyautoornot == -1 && !empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
- $label = ' '.$label;
- $repid[-99] = $langs->trans("ActionAC_MANUAL");
- $repcode['AC_NON_AUTO'] = $langs->trans("ActionAC_MANUAL");
+ if ($typecalendar == 'system') {
+ $label = ' '.$label;
+ $repid[-99] = $langs->trans("ActionAC_MANUAL");
+ $repcode['AC_NON_AUTO'] = '-- '.$langs->trans("ActionAC_MANUAL");
+ }
+ if ($typecalendar == 'systemauto') {
+ $label = ' '.$label;
+ $repid[-98] = $langs->trans("ActionAC_AUTO");
+ $repcode['AC_ALL_AUTO'] = '-- '.$langs->trans("ActionAC_AUTO");
+ }
+ if ($typecalendar == 'module') {
+ $label = ' '.$label;
+ if (!isset($repcode['AC_ALL_'.strtoupper($obj->module)])) { // If first time for this module
+ $idforallfornewmodule--;
+ }
+ $repid[$idforallfornewmodule] = $langs->trans("ActionAC_ALL_".strtoupper($obj->module));
+ $repcode['AC_ALL_'.strtoupper($obj->module)] = '-- '.$langs->trans("Module").' '.ucfirst($obj->module);
+ }
}
$repid[$obj->id] = $label;
$repcode[$obj->code] = $label;
- if ($onlyautoornot > 0 && preg_match('/^module/', $obj->type) && $obj->module) $repcode[$obj->code] .= ' ('.$langs->trans("Module").': '.$obj->module.')';
+ $repall[$obj->code] = array('id' => $label, 'label' => $label, 'type' => $typecalendar, 'color' => $obj->color, 'picto' => $obj->picto);
+ if ($onlyautoornot > 0 && preg_match('/^module/', $obj->type) && $obj->module) {
+ $repcode[$obj->code] .= ' ('.$langs->trans("Module").': '.$obj->module.')';
+ $repall[$obj->code]['label'] .= ' ('.$langs->trans("Module").': '.$obj->module.')';
+ }
}
$i++;
}
}
+
if ($idorcode == 'id') $this->liste_array = $repid;
- if ($idorcode == 'code') $this->liste_array = $repcode;
+ elseif ($idorcode == 'code') $this->liste_array = $repcode;
+ else $this->liste_array = $repall;
+
return $this->liste_array;
} else {
$this->error = $this->db->lasterror();
diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php
index 5b4cc58bb08..2d0c1dc8133 100644
--- a/htdocs/comm/action/document.php
+++ b/htdocs/comm/action/document.php
@@ -80,7 +80,7 @@ $modulepart = 'actions';
/*
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index d5f5edbb143..f9274189109 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -114,8 +114,7 @@ if ($status == '' && !GETPOSTISSET('search_status')) $status = (empty($conf->glo
$defaultview = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
$defaultview = (empty($user->conf->AGENDA_DEFAULT_VIEW) ? $defaultview : $user->conf->AGENDA_DEFAULT_VIEW);
if (empty($action) && !GETPOSTISSET('action')) $action = $defaultview;
-if ($action == 'default') // When action is default, we want a calendar view and not the list
-{
+if ($action == 'default') { // When action is default, we want a calendar view and not the list
$action = (($defaultview != 'show_list') ? $defaultview : 'show_month');
}
if (GETPOST('viewcal', 'restricthtml') && GETPOST('action', 'alpha') != 'show_day' && GETPOST('action', 'alpha') != 'show_week') {
@@ -346,8 +345,8 @@ if ($resourceid > 0) $param .= "&search_resourceid=".urlencode($resourceid);
if ($status || GETPOSTISSET('status')) $param .= "&search_status=".urlencode($status);
if ($filter) $param .= "&search_filter=".urlencode($filter);
if ($filtert) $param .= "&search_filtert=".urlencode($filtert);
-if ($usergroup) $param .= "&search_usergroup=".urlencode($usergroup);
-if ($socid) $param .= "&search_socid=".urlencode($socid);
+if ($usergroup > 0) $param .= "&search_usergroup=".urlencode($usergroup);
+if ($socid > 0) $param .= "&search_socid=".urlencode($socid);
if ($showbirthday) $param .= "&search_showbirthday=1";
if ($pid) $param .= "&search_projectid=".urlencode($pid);
if ($type) $param .= "&search_type=".urlencode($type);
@@ -357,32 +356,32 @@ $param .= "&maxprint=".urlencode($maxprint);
// Show navigation bar
if (empty($action) || $action == 'show_month')
{
- $nav = " \n";
+ $nav = " \n";
$nav .= " ".dol_print_date(dol_mktime(0, 0, 0, $month, 1, $year), "%b %Y");
$nav .= " \n";
- $nav .= " \n";
+ $nav .= " \n";
if (empty($conf->dol_optimize_smallscreen)) {
- $nav .= " ".$langs->trans("Today")." ";
+ $nav .= " ".$langs->trans("Today")." ";
}
$picto = 'calendar';
}
if ($action == 'show_week')
{
- $nav = "trans("Previous"))."\"> \n";
+ $nav = "trans("Previous"))."\"> \n";
$nav .= " ".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("Week")." ".$week;
$nav .= " \n";
- $nav .= " trans("Next"))."\"> \n";
+ $nav .= " trans("Next"))."\"> \n";
if (empty($conf->dol_optimize_smallscreen)) {
- $nav .= " ".$langs->trans("Today")." ";
+ $nav .= " ".$langs->trans("Today")." ";
}
$picto = 'calendarweek';
}
if ($action == 'show_day')
{
- $nav = " \n";
+ $nav = " \n";
$nav .= " ".dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "daytextshort");
$nav .= " \n";
- $nav .= " \n";
+ $nav .= " \n";
if (empty($conf->dol_optimize_smallscreen)) {
$nav .= " ".$langs->trans("Today")." ";
}
@@ -394,6 +393,7 @@ $nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
$nav .= ' ';
// Must be after the nav definition
+$paramnodate = $param;
$param .= '&year='.$year.'&month='.$month.($day ? '&day='.$day : '');
//print 'x'.$param;
@@ -410,6 +410,7 @@ if ($action == 'show_pertype') $tabactive = 'cardpertype';
*/
$paramnoaction = preg_replace('/action=[a-z_]+/', '', $param);
+$paramnoactionodate = preg_replace('/action=[a-z_]+/', '', $paramnodate);
$head = calendars_prepare_head($paramnoaction);
@@ -422,31 +423,31 @@ print ' ';
//print dol_get_fiche_end();
$viewmode = '';
-$viewmode .= '';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("List"), 'object_list-alt', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewList").' ';
-$viewmode .= '';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewCal").' ';
-$viewmode .= '';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewWeek").' ';
-$viewmode .= '';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewDay").' ';
-$viewmode .= '';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"');
//$viewmode .= ' ';
@@ -486,8 +487,8 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on
$s .= "\n".''."\n";
$s .= ''."\n";
}
@@ -1921,7 +1988,6 @@ function sort_events_by_date($a, $b)
{
return -1;
}
-
if ($b->type_code === 'HOLIDAY')
{
return 1;
diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php
index 03dc3b4881c..68925c57bfa 100644
--- a/htdocs/comm/action/list.php
+++ b/htdocs/comm/action/list.php
@@ -269,11 +269,11 @@ if ($resourceid > 0) $param .= "&search_resourceid=".urlencode($resourceid);
if ($search_status != '' && $search_status > -1) $param .= "&search_status=".urlencode($search_status);
if ($filter) $param .= "&search_filter=".urlencode($filter);
if ($filtert) $param .= "&search_filtert=".urlencode($filtert);
-if ($socid) $param .= "&search_socid=".urlencode($socid);
+if ($usergroup > 0) $param .= "&search_usergroup=".urlencode($usergroup);
+if ($socid > 0) $param .= "&search_socid=".urlencode($socid);
if ($showbirthday) $param .= "&search_showbirthday=1";
if ($pid) $param .= "&search_projectid=".urlencode($pid);
if ($type) $param .= "&search_type=".urlencode($type);
-if ($usergroup) $param .= "&search_usergroup=".urlencode($usergroup);
if ($search_id != '') $param .= '&search_title='.urlencode($search_id);
if ($search_title != '') $param .= '&search_title='.urlencode($search_title);
if ($search_note != '') $param .= '&search_note='.$search_note;
@@ -287,6 +287,8 @@ if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
+$paramnoactionodate = $param;
+
// List of mass actions available
$arrayofmassactions = array(
'set_all_events_to_todo' => $langs->trans("SetAllEventsToTodo"),
@@ -308,7 +310,7 @@ $sql .= " a.id, a.code, a.label, a.note, a.datep as dp, a.datep2 as dp2, a.fulld
$sql .= ' a.fk_user_author,a.fk_user_action,';
$sql .= " a.fk_contact, a.note, a.percent as percent,";
$sql .= " a.fk_element, a.elementtype, a.datec, a.tms as datem,";
-$sql .= " c.code as type_code, c.libelle as type_label,";
+$sql .= " c.code as type_code, c.libelle as type_label, c.color as type_color, c.type as type_type, c.picto as type_picto,";
$sql .= " sp.lastname, sp.firstname, sp.email, sp.phone, sp.address, sp.phone as phone_pro, sp.phone_mobile, sp.phone_perso, sp.fk_pays as country_id";
// Add fields from extrafields
@@ -481,31 +483,31 @@ if ($resql)
}
$viewmode = '';
- $viewmode .= ' ';
+ $viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("List"), 'object_list-alt', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewList").' ';
- $viewmode .= '';
+ $viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewCal").' ';
- $viewmode .= '';
+ $viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewWeek").' ';
- $viewmode .= '';
+ $viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewDay").' ';
- $viewmode .= '';
+ $viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"');
//$viewmode .= ' ';
@@ -657,6 +659,7 @@ if ($resql)
$actionstatic->type_code = $obj->type_code;
$actionstatic->type_label = $obj->type_label;
$actionstatic->type_picto = $obj->type_picto;
+ $actionstatic->type_color = $obj->type_color;
$actionstatic->label = $obj->label;
$actionstatic->location = $obj->location;
$actionstatic->note_private = dol_htmlentitiesbr($obj->note);
diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php
index a399ee3d580..613ffee7be7 100644
--- a/htdocs/comm/action/pertype.php
+++ b/htdocs/comm/action/pertype.php
@@ -236,8 +236,8 @@ if ($resourceid > 0) $param .= "&search_resourceid=".urlencode($resourceid);
if ($status || GETPOSTISSET('status')) $param .= "&search_status=".urlencode($status);
if ($filter) $param .= "&search_filter=".urlencode($filter);
if ($filtert) $param .= "&search_filtert=".urlencode($filtert);
-if ($usergroup) $param .= "&search_usergroup=".urlencode($usergroup);
-if ($socid) $param .= "&search_socid=".urlencode($socid);
+if ($usergroup > 0) $param .= "&search_usergroup=".urlencode($usergroup);
+if ($socid > 0) $param .= "&search_socid=".urlencode($socid);
if ($showbirthday) $param .= "&search_showbirthday=1";
if ($pid) $param .= "&search_projectid=".urlencode($pid);
if ($type) $param .= "&search_type=".urlencode($type);
@@ -248,6 +248,8 @@ if ($begin_d != '') $param .= '&begin_d='.urlencode($begin_d);
if ($end_d != '') $param .= '&end_d='.urlencode($end_d);
$param .= "&maxprint=".urlencode($maxprint);
+$paramnoactionodate = $param;
+
$prev = dol_get_first_day($year, 1);
$prev_year = $year - 1;
$prev_month = $month;
@@ -352,31 +354,31 @@ if ($conf->use_javascript_ajax)
$massactionbutton = '';
$viewmode = '';
-$viewmode .= ' ';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("List"), 'object_list-alt', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewList").' ';
-$viewmode .= '';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewCal").' ';
-$viewmode .= '';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewWeek").' ';
-$viewmode .= '';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewDay").' ';
-$viewmode .= '';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"');
//$viewmode .= ' ';
@@ -430,6 +432,8 @@ print '';
// Get event in an array
$eventarray = array();
+
+// DEFAULT CALENDAR + AUTOEVENT CALENDAR + CONFERENCEBOOTH CALENDAR
$sql = 'SELECT';
if ($usergroup > 0) $sql .= " DISTINCT";
$sql .= ' a.id, a.label,';
@@ -439,7 +443,7 @@ $sql .= ' a.percent,';
$sql .= ' a.fk_user_author,a.fk_user_action,';
$sql .= ' a.transparency, a.priority, a.fulldayevent, a.location,';
$sql .= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype, a.fk_project,';
-$sql .= ' ca.code, ca.color';
+$sql .= ' ca.code, ca.libelle as type_label, ca.color, ca.type as type_type, ca.picto as type_picto';
$sql .= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
// We must filter on resource table
diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php
index 6b54a327705..34a4cc232b6 100644
--- a/htdocs/comm/action/peruser.php
+++ b/htdocs/comm/action/peruser.php
@@ -236,8 +236,8 @@ if ($resourceid > 0) $param .= "&search_resourceid=".urlencode($resourceid);
if ($status || GETPOSTISSET('status')) $param .= "&search_status=".urlencode($status);
if ($filter) $param .= "&search_filter=".urlencode($filter);
if ($filtert) $param .= "&search_filtert=".urlencode($filtert);
-if ($usergroup) $param .= "&search_usergroup=".urlencode($usergroup);
-if ($socid) $param .= "&search_socid=".urlencode($socid);
+if ($usergroup > 0) $param .= "&search_usergroup=".urlencode($usergroup);
+if ($socid > 0) $param .= "&search_socid=".urlencode($socid);
if ($showbirthday) $param .= "&search_showbirthday=1";
if ($pid) $param .= "&search_projectid=".urlencode($pid);
if ($type) $param .= "&search_type=".urlencode($type);
@@ -248,6 +248,7 @@ if ($begin_d != '') $param .= '&begin_d='.urlencode($begin_d);
if ($end_d != '') $param .= '&end_d='.urlencode($end_d);
$param .= "&maxprint=".urlencode($maxprint);
+$paramnoactionodate = $param;
$prev = dol_get_first_day_week($day, $month, $year);
//print "day=".$day." month=".$month." year=".$year;
@@ -357,31 +358,31 @@ if ($conf->use_javascript_ajax)
$massactionbutton = '';
$viewmode = '';
-$viewmode .= ' ';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("List"), 'object_list-alt', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewList").' ';
-$viewmode .= '';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewCal").' ';
-$viewmode .= '';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewWeek").' ';
-$viewmode .= '';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewDay").' ';
-$viewmode .= '';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"');
//$viewmode .= ' ';
@@ -435,10 +436,11 @@ print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $show
print '';
-
// Get event in an array
$eventarray = array();
+
+// DEFAULT CALENDAR + AUTOEVENT CALENDAR + CONFERENCEBOOTH CALENDAR
$sql = 'SELECT';
if ($usergroup > 0) $sql .= " DISTINCT";
$sql .= ' a.id, a.label,';
@@ -448,7 +450,7 @@ $sql .= ' a.percent,';
$sql .= ' a.fk_user_author,a.fk_user_action,';
$sql .= ' a.transparency, a.priority, a.fulldayevent, a.location,';
$sql .= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype, a.fk_project,';
-$sql .= ' ca.code, ca.color';
+$sql .= ' ca.code, ca.libelle as type_label, ca.color, ca.type as type_type, ca.picto as type_picto';
$sql .= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
// We must filter on resource table
diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index 1be8d68760e..d335e37b482 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -7,7 +7,7 @@
* Copyright (C) 2008 Raphael Bertrand (Resultic)
* Copyright (C) 2010-2020 Juanjo Menent
* Copyright (C) 2013 Alexandre Spangaro
- * Copyright (C) 2015-2019 Frédéric France
+ * Copyright (C) 2015-2021 Frédéric France
* Copyright (C) 2015 Marcos García
* Copyright (C) 2020 Open-Dsi
*
@@ -741,12 +741,11 @@ if ($object->id > 0)
/*
* Latest proposals
*/
- if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
- {
+ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$langs->load("propal");
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht";
- $sql .= ", p.tva as total_tva";
+ $sql .= ", p.total_tva";
$sql .= ", p.total as total_ttc";
$sql .= ", p.ref, p.ref_client, p.remise";
$sql .= ", p.datep as dp, p.fin_validite as date_limit";
@@ -780,7 +779,7 @@ if ($object->id > 0)
$objp = $db->fetch_object($resql);
print '';
- print '';
+ print ' ';
$propal_static->id = $objp->propalid;
$propal_static->ref = $objp->ref;
$propal_static->ref_client = $objp->ref_client;
@@ -815,7 +814,7 @@ if ($object->id > 0)
{
$sql = "SELECT s.nom, s.rowid";
$sql .= ", c.rowid as cid, c.total_ht";
- $sql .= ", c.tva as total_tva";
+ $sql .= ", c.total_tva";
$sql .= ", c.total_ttc";
$sql .= ", c.ref, c.ref_client, c.fk_statut, c.facture";
$sql .= ", c.date_commande as dc";
@@ -871,7 +870,7 @@ if ($object->id > 0)
$commande_static->billed = $objp->billed;
print ' ';
- print '';
+ print ' ';
print $commande_static->getNomUrl(1);
print ' '.dol_print_date($db->jdate($objp->dc), 'day')." \n";
print ''.price($objp->total_ht).' ';
@@ -938,7 +937,7 @@ if ($object->id > 0)
$sendingstatic->ref = $objp->ref;
print ' ';
- print '';
+ print ' ';
print $sendingstatic->getNomUrl(1);
print ' ';
if ($objp->date_creation > 0) {
@@ -1014,7 +1013,7 @@ if ($object->id > 0)
}
print ' ';
- print '';
+ print ' ';
print $contrat->getNomUrl(1, 12);
print $late;
print " \n";
@@ -1076,10 +1075,13 @@ if ($object->id > 0)
$objp = $db->fetch_object($resql);
$fichinter_static->id = $objp->id;
+ $fichinter_static->ref = $objp->ref;
$fichinter_static->statut = $objp->fk_statut;
print ' ';
- print ''.img_object($langs->trans("ShowPropal"), "propal").' '.$objp->ref.' '."\n";
+ print '';
+ print $fichinter_static->getNomUrl(1);
+ print ' '."\n";
//print ''.dol_print_date($db->jdate($objp->startdate)).' '."\n";
print ''.convertSecondToTime($objp->duration).' '."\n";
print ''.$fichinter_static->getLibStatut(5).' '."\n";
@@ -1210,7 +1212,7 @@ if ($object->id > 0)
$sql .= ', f.total as total_ht';
$sql .= ', f.tva as total_tva';
$sql .= ', f.total_ttc';
- $sql .= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut';
+ $sql .= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as status';
$sql .= ', s.nom, s.rowid as socid';
$sql .= ', SUM(pf.amount) as am';
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
@@ -1251,9 +1253,10 @@ if ($object->id > 0)
$facturestatic->total_ht = $objp->total_ht;
$facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc;
+ $facturestatic->statut = $objp->status;
print ' ';
- print '';
+ print ' ';
print $facturestatic->getNomUrl(1);
print ' ';
if ($objp->df > 0)
@@ -1273,7 +1276,7 @@ if ($object->id > 0)
print '';
}
- print ''.($facturestatic->LibStatut($objp->paye, $objp->statut, 5, $objp->am)).' ';
+ print ''.($facturestatic->LibStatut($objp->paye, $objp->status, 5, $objp->am)).' ';
print " \n";
$i++;
}
diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php
index 46636f93812..e4d04ace6ae 100644
--- a/htdocs/comm/index.php
+++ b/htdocs/comm/index.php
@@ -137,7 +137,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) {
* Draft customer proposals
*/
if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
- $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.fk_statut as status";
+ $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total as total_ttc, p.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
@@ -228,7 +228,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
* Draft supplier proposals
*/
if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) {
- $sql = "SELECT p.rowid, p.ref, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.fk_statut as status";
+ $sql = "SELECT p.rowid, p.ref, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
@@ -318,7 +318,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
* Draft customer orders
*/
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
- $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, c.fk_statut as status";
+ $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.total_tva, c.total_ttc, c.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
@@ -765,7 +765,7 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) { // T
* Opened (validated) proposals
*/
if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
- $sql = "SELECT p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
+ $sql = "SELECT p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
@@ -875,7 +875,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
* Opened (validated) order
*/
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
- $sql = "SELECT c.rowid as commandeid, c.total_ttc, c.total_ht, c.tva as total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed";
+ $sql = "SELECT c.rowid as commandeid, c.total_ttc, c.total_ht, c.total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index a115d8bca5e..aadc1f55281 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -285,7 +285,7 @@ class Propal extends CommonObject
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
- 'tva' =>array('type'=>'double(24,8)', 'label'=>'VAT', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1),
+ 'total_tva' =>array('type'=>'double(24,8)', 'label'=>'VAT', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1),
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
'total' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1),
@@ -1038,7 +1038,7 @@ class Propal extends CommonObject
$sql .= ", remise";
$sql .= ", remise_percent";
$sql .= ", remise_absolue";
- $sql .= ", tva";
+ $sql .= ", total_tva";
$sql .= ", total";
$sql .= ", datep";
$sql .= ", datec";
@@ -1425,7 +1425,7 @@ class Propal extends CommonObject
public function fetch($rowid, $ref = '', $ref_ext = '')
{
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
- $sql .= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht";
+ $sql .= ", p.total, p.total_tva, p.localtax1, p.localtax2, p.total_ht";
$sql .= ", p.datec";
$sql .= ", p.date_valid as datev";
$sql .= ", p.datep as dp";
@@ -1483,7 +1483,7 @@ class Propal extends CommonObject
$this->remise_absolue = $obj->remise_absolue;
$this->total = $obj->total; // TODO deprecated
$this->total_ht = $obj->total_ht;
- $this->total_tva = $obj->tva;
+ $this->total_tva = $obj->total_tva;
$this->total_localtax1 = $obj->localtax1;
$this->total_localtax2 = $obj->localtax2;
$this->total_ttc = $obj->total;
@@ -1618,7 +1618,7 @@ class Propal extends CommonObject
$sql .= " datep=".(strval($this->date) != '' ? "'".$this->db->idate($this->date)."'" : 'null').",";
if (!empty($this->fin_validite)) $sql .= " fin_validite=".(strval($this->fin_validite) != '' ? "'".$this->db->idate($this->fin_validite)."'" : 'null').",";
$sql .= " date_valid=".(strval($this->date_validation) != '' ? "'".$this->db->idate($this->date_validation)."'" : 'null').",";
- $sql .= " tva=".(isset($this->total_tva) ? $this->total_tva : "null").",";
+ $sql .= " total_tva=".(isset($this->total_tva) ? $this->total_tva : "null").",";
$sql .= " localtax1=".(isset($this->total_localtax1) ? $this->total_localtax1 : "null").",";
$sql .= " localtax2=".(isset($this->total_localtax2) ? $this->total_localtax2 : "null").",";
$sql .= " total_ht=".(isset($this->total_ht) ? $this->total_ht : "null").",";
diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php
index fbe7fdbec5c..530f7392f54 100644
--- a/htdocs/comm/propal/document.php
+++ b/htdocs/comm/propal/document.php
@@ -80,7 +80,7 @@ if ($object->id > 0)
{
$object->fetch_thirdparty();
$upload_dir = $conf->propal->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
- include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
}
diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php
index b51f138b0e5..c274ebf74f3 100644
--- a/htdocs/comm/propal/index.php
+++ b/htdocs/comm/propal/index.php
@@ -198,7 +198,7 @@ if ($resql)
* Draft proposals
*/
if (!empty($conf->propal->enabled)) {
- $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc";
+ $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total as total_ttc";
$sql .= ", s.rowid as socid, s.nom as name, s.client, s.canvas, s.code_client, s.email, s.entity, s.code_compta";
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 5eca82f022c..d05543530d1 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -181,14 +181,14 @@ $arrayfields = array(
'p.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>0),
'p.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0),
'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
- 'p.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
+ 'p.total_tva'=>array('label'=>"AmountVAT", 'checked'=>0),
'p.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
'p.total_ht_invoiced'=>array('label'=>"AmountInvoicedHT", 'checked'=>0, 'enabled'=>!empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
'p.total_invoiced'=>array('label'=>"AmountInvoicedTTC", 'checked'=>0, 'enabled'=>!empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
'p.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
'p.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
'p.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
- 'p.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
+ 'p.multicurrency_total_tva'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
'p.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
'p.multicurrency_total_ht_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedHT', 'checked'=>0, 'enabled'=>!empty($conf->multicurrency->enabled) && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
'p.multicurrency_total_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedTTC', 'checked'=>0, 'enabled'=>!empty($conf->multicurrency->enabled) && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
@@ -391,8 +391,8 @@ $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.tow
$sql .= " typent.code as typent_code,";
$sql .= " ava.rowid as availability,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
-$sql .= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut as status, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,';
-$sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva as multicurrency_total_vat, p.multicurrency_total_ttc,';
+$sql .= ' p.rowid, p.entity, p.note_private, p.total_ht, p.total_tva, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut as status, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,';
+$sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
$sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
$sql .= ' p.note_public, p.note_private,';
$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,';
@@ -449,7 +449,7 @@ if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_societe_alias) $sql .= natural_search('s.name_alias', $search_societe_alias);
if ($search_login) $sql .= natural_search("u.login", $search_login);
if ($search_montant_ht != '') $sql .= natural_search("p.total_ht", $search_montant_ht, 1);
-if ($search_montant_vat != '') $sql .= natural_search("p.tva", $search_montant_vat, 1);
+if ($search_montant_vat != '') $sql .= natural_search("p.total_tva", $search_montant_vat, 1);
if ($search_montant_ttc != '') $sql .= natural_search("p.total", $search_montant_ttc, 1);
if ($search_multicurrency_code != '') $sql .= ' AND p.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"';
if ($search_multicurrency_tx != '') $sql .= natural_search('p.multicurrency_tx', $search_multicurrency_tx, 1);
@@ -834,7 +834,7 @@ if ($resql)
print ' ';
print ' ';
}
- if (!empty($arrayfields['p.total_vat']['checked']))
+ if (!empty($arrayfields['p.total_tva']['checked']))
{
// Amount
print '';
@@ -881,7 +881,7 @@ if ($resql)
print ' ';
print ' ';
}
- if (!empty($arrayfields['p.multicurrency_total_vat']['checked']))
+ if (!empty($arrayfields['p.multicurrency_total_tva']['checked']))
{
// Amount
print '';
@@ -992,14 +992,14 @@ if ($resql)
if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) print_liste_field_titre($arrayfields['p.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "p.fk_cond_reglement", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['p.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['p.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "p.fk_mode_reglement", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder);
- if (!empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'], $_SERVER["PHP_SELF"], 'p.tva', '', $param, 'class="right"', $sortfield, $sortorder);
+ if (!empty($arrayfields['p.total_tva']['checked'])) print_liste_field_titre($arrayfields['p.total_tva']['label'], $_SERVER["PHP_SELF"], 'p.total_tva', '', $param, 'class="right"', $sortfield, $sortorder);
if (!empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder);
if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder);
if (!empty($arrayfields['p.total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder);
if (!empty($arrayfields['p.multicurrency_code']['checked'])) print_liste_field_titre($arrayfields['p.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_code', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['p.multicurrency_tx']['checked'])) print_liste_field_titre($arrayfields['p.multicurrency_tx']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_tx', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) print_liste_field_titre($arrayfields['p.multicurrency_total_ht']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_ht', '', $param, 'class="right"', $sortfield, $sortorder);
- if (!empty($arrayfields['p.multicurrency_total_vat']['checked'])) print_liste_field_titre($arrayfields['p.multicurrency_total_vat']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_tva', '', $param, 'class="right"', $sortfield, $sortorder);
+ if (!empty($arrayfields['p.multicurrency_total_tva']['checked'])) print_liste_field_titre($arrayfields['p.multicurrency_total_tva']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_tva', '', $param, 'class="right"', $sortfield, $sortorder);
if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_ttc', '', $param, 'class="right"', $sortfield, $sortorder);
if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.multicurrency_total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder);
if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.multicurrency_total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder);
@@ -1267,12 +1267,12 @@ if ($resql)
$totalarray['val']['p.total_ht'] += $obj->total_ht;
}
// Amount VAT
- if (!empty($arrayfields['p.total_vat']['checked']))
+ if (!empty($arrayfields['p.total_tva']['checked']))
{
- print ' '.price($obj->total_vat)." \n";
+ print ''.price($obj->total_tva)." \n";
if (!$i) $totalarray['nbfield']++;
- if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_vat';
- $totalarray['val']['p.total_vat'] += $obj->total_vat;
+ if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_tva';
+ $totalarray['val']['p.total_tva'] += $obj->total_tva;
}
// Amount TTC
if (!empty($arrayfields['p.total_ttc']['checked']))
@@ -1320,9 +1320,9 @@ if ($resql)
if (!$i) $totalarray['nbfield']++;
}
// Amount VAT
- if (!empty($arrayfields['p.multicurrency_total_vat']['checked']))
+ if (!empty($arrayfields['p.multicurrency_total_tva']['checked']))
{
- print ''.price($obj->multicurrency_total_vat)." \n";
+ print ''.price($obj->multicurrency_total_tva)." \n";
if (!$i) $totalarray['nbfield']++;
}
// Amount TTC
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 6b75d57d082..cb16e419ee8 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -313,7 +313,7 @@ class Commande extends CommonOrder
'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
- 'tva' =>array('type'=>'double(24,8)', 'label'=>'VAT', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
+ 'total_tva' =>array('type'=>'double(24,8)', 'label'=>'VAT', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1),
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
@@ -1791,7 +1791,7 @@ class Commande extends CommonOrder
if (empty($id) && empty($ref) && empty($ref_ext)) return -1;
$sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut';
- $sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
+ $sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
$sql .= ', c.fk_account';
$sql .= ', c.date_commande, c.date_valid, c.tms';
$sql .= ', c.date_livraison as delivery_date';
@@ -3297,7 +3297,7 @@ class Commande extends CommonOrder
$sql .= " fk_soc=".(isset($this->socid) ? $this->socid : "null").",";
$sql .= " date_commande=".(strval($this->date_commande) != '' ? "'".$this->db->idate($this->date_commande)."'" : 'null').",";
$sql .= " date_valid=".(strval($this->date_validation) != '' ? "'".$this->db->idate($this->date_validation)."'" : 'null').",";
- $sql .= " tva=".(isset($this->total_tva) ? $this->total_tva : "null").",";
+ $sql .= " total_tva=".(isset($this->total_tva) ? $this->total_tva : "null").",";
$sql .= " localtax1=".(isset($this->total_localtax1) ? $this->total_localtax1 : "null").",";
$sql .= " localtax2=".(isset($this->total_localtax2) ? $this->total_localtax2 : "null").",";
$sql .= " total_ht=".(isset($this->total_ht) ? $this->total_ht : "null").",";
diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php
index 7df7dbea130..add4244d7dc 100644
--- a/htdocs/commande/contact.php
+++ b/htdocs/commande/contact.php
@@ -3,6 +3,7 @@
* Copyright (C) 2005-2011 Laurent Destailleur
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2011-2015 Philippe Grand
+ * Copyright (C) 2021 Frédéric France
*
* 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
@@ -128,23 +129,17 @@ $userstatic = new User($db);
/* */
/* *************************************************************************** */
-if ($id > 0 || !empty($ref))
-{
- $langs->trans("OrderCard");
-
- if ($object->fetch($id, $ref) > 0)
- {
+if ($id > 0 || !empty($ref)) {
+ if ($object->fetch($id, $ref) > 0) {
$object->fetch_thirdparty();
$head = commande_prepare_head($object);
print dol_get_fiche_head($head, 'contact', $langs->trans("CustomerOrder"), -1, 'order');
-
// Order card
$linkback = ''.$langs->trans("BackToList").' ';
-
$morehtmlref = '';
// Ref customer
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php
index f95f61b6025..f51d8635787 100644
--- a/htdocs/commande/document.php
+++ b/htdocs/commande/document.php
@@ -80,7 +80,7 @@ if ($object->fetch($id))
$upload_dir = $conf->commande->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref);
}
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 8b4a79f4dda..a5f548d6e6a 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -286,7 +286,7 @@ if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DI
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
$sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
-$sql .= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
+$sql .= ' c.rowid, c.ref, c.total_ht, c.total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
$sql .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva as multicurrency_total_vat, c.multicurrency_total_ttc,';
$sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
$sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
@@ -369,7 +369,7 @@ if ($search_company_alias) $sql .= natural_search('s.name_alia
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale;
if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
if ($search_total_ht != '') $sql .= natural_search('c.total_ht', $search_total_ht, 1);
-if ($search_total_vat != '') $sql .= natural_search('c.tva', $search_total_vat, 1);
+if ($search_total_vat != '') $sql .= natural_search('c.total_tva', $search_total_vat, 1);
if ($search_total_ttc != '') $sql .= natural_search('c.total_ttc', $search_total_ttc, 1);
if ($search_warehouse != '' && $search_warehouse != '-1') $sql .= natural_search('c.fk_warehouse', $search_warehouse, 1);
if ($search_multicurrency_code != '') $sql .= ' AND c.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"';
@@ -941,7 +941,7 @@ if ($resql)
if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) print_liste_field_titre($arrayfields['c.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "c.fk_cond_reglement", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['c.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['c.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "c.fk_mode_reglement", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'], $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, '', $sortfield, $sortorder, 'right ');
- if (!empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'c.tva', '', $param, '', $sortfield, $sortorder, 'right ');
+ if (!empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'c.total_tva', '', $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'], $_SERVER["PHP_SELF"], 'c.total_ttc', '', $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['c.multicurrency_code']['checked'])) print_liste_field_titre($arrayfields['c.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'c.multicurrency_code', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['c.multicurrency_tx']['checked'])) print_liste_field_titre($arrayfields['c.multicurrency_tx']['label'], $_SERVER['PHP_SELF'], 'c.multicurrency_tx', '', $param, '', $sortfield, $sortorder);
diff --git a/htdocs/compta/bank/account_statement_document.php b/htdocs/compta/bank/account_statement_document.php
index fd7c6b1d292..b1c5c937f76 100644
--- a/htdocs/compta/bank/account_statement_document.php
+++ b/htdocs/compta/bank/account_statement_document.php
@@ -133,7 +133,7 @@ if (!empty($numref))
$upload_dir = $conf->bank->dir_output."/".$id."/statement/".dol_sanitizeFileName($numref);
}
$backtopage = $_SERVER['PHP_SELF']."?account=".$id."&num=".$numref;
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php
index 9bf350f5f35..419ecf238c5 100644
--- a/htdocs/compta/bank/bankentries_list.php
+++ b/htdocs/compta/bank/bankentries_list.php
@@ -482,9 +482,7 @@ if ($id > 0 || !empty($ref))
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,";
$sql .= " b.fk_account, b.fk_type,";
-$sql .= " ba.rowid as bankid, ba.ref as bankref,";
-$sql .= " bu.url_id, bu.type as type_url,";
-$sql .= " s.nom, s.name_alias, s.client, s.fournisseur, s.email, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
+$sql .= " ba.rowid as bankid, ba.ref as bankref";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
@@ -498,8 +496,6 @@ if ($search_bid > 0) $sql .= MAIN_DB_PREFIX."bank_class as l,";
$sql .= " ".MAIN_DB_PREFIX."bank_account as ba,";
$sql .= " ".MAIN_DB_PREFIX."bank as b";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)";
-$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND type = 'company'";
-$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid";
$sql .= " WHERE b.fk_account = ba.rowid";
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
if ($search_account > 0) $sql .= " AND b.fk_account = ".$search_account;
@@ -513,7 +509,20 @@ if ($search_ref) $sql .= natural_search("b.rowid", $search_ref, 1);
if ($search_req_nb) $sql .= natural_search("b.num_chq", $search_req_nb);
if ($search_num_releve) $sql .= natural_search("b.num_releve", $search_num_releve);
if ($search_conciliated != '' && $search_conciliated != '-1') $sql .= " AND b.rappro = ".urlencode($search_conciliated);
-if ($search_thirdparty_user) $sql .= natural_search(array("s.nom", "u.firstname", "u.lastname"), $search_thirdparty_user);
+if ($search_thirdparty_user) {
+ $sql.= " AND (b.rowid IN ";
+ $sql.= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu";
+ $sql.= " JOIN ".MAIN_DB_PREFIX."bank AS b2 ON b2.rowid = bu.fk_bank";
+ $sql.= " JOIN ".MAIN_DB_PREFIX."user AS subUser ON (bu.type = 'user' AND bu.url_id = subUser.rowid)";
+ $sql.= " WHERE ". natural_search(array("subUser.firstname", "subUser.lastname"), $search_thirdparty_user, '', 1)."))";
+
+ $sql.= " OR b.rowid IN ";
+ $sql.= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu";
+ $sql.= " JOIN ".MAIN_DB_PREFIX."bank AS b2 ON b2.rowid = bu.fk_bank";
+ $sql.= " JOIN ".MAIN_DB_PREFIX."societe AS subSoc ON (bu.type = 'company' AND bu.url_id = subSoc.rowid)";
+ $sql.= " WHERE ". natural_search(array("subSoc.nom"), $search_thirdparty_user, '', 1);
+ $sql.= ")";
+}
if ($search_description)
{
$search_description_to_use = $search_description;
@@ -1376,52 +1385,40 @@ if ($resql)
// Third party
if (!empty($arrayfields['bu.label']['checked']))
{
- print '
';
- if ($objp->url_id)
- {
- if ($objp->type_url == 'company') {
- $companystatic->id = $objp->url_id;
- $companystatic->name = $objp->nom;
- $companystatic->name_alias = $objp->name_alias;
- $companystatic->client = $objp->client;
- $companystatic->email = $objp->email;
- $companystatic->fournisseur = $objp->fournisseur;
- $companystatic->code_client = $objp->code_client;
- $companystatic->code_fournisseur = $objp->code_fournisseur;
- $companystatic->code_compta = $objp->code_compta;
- $companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
- print $companystatic->getNomUrl(1);
+ print ' ';
+
+ $companylinked_id = 0;
+ $userlinked_id = 0;
+
+ //payment line type to define user display and user or company linked
+ foreach ($links as $key=>$value){
+ if ($links[$key]['type'] == 'payment_sc') $type_link = 'payment_sc';
+ if ($links[$key]['type'] == 'payment_salary') $type_link = 'payment_salary';
+
+ if ($links[$key]['type'] == 'company') {
+ $companylinked_id = $links[$key]['url_id'];
+ }
+ if ($links[$key]['type'] == 'user') {
+ $userlinked_id = $links[$key]['url_id'];
}
}
- else //display user or nothing
- {
- //payment line type to define user display
- foreach ($links as $key=>$value){
- if ($links[$key]['type'] == 'payment_sc') $type_link = 'payment_sc';
- if ($links[$key]['type'] == 'payment_salary') $type_link = 'payment_salary';
- }
- $sqlu = "SELECT url_id FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank=".$objp->rowid." AND (type='user' OR type='salary')";
- $resqlu = $db->query($sqlu);
-
- if ($resqlu) {
- if ($db->num_rows($resqlu) > 0 &&
- (($type_link == 'payment_salary' && !empty($user->rights->salaries->read))
- || ($type_link == 'payment_sc' && !empty($user->rights->tax->charges->lire)))) {
- $obj = $db->fetch_object($resqlu);
- $userstatic->fetch($obj->url_id);
- print $userstatic->getNomUrl(1);
- }
-
- else {
- print ' ';
- }
- } else {
- dol_print_error($db);
- }
+ if ($companylinked_id) {
+ // TODO Add a cache of loaded companies here
+ $companystatic->fetch($companylinked_id);
+ print $companystatic->getNomUrl(1);
+ } elseif ($userlinked_id &&
+ (($type_link == 'payment_salary' && !empty($user->rights->salaries->read))
+ || ($type_link == 'payment_sc' && !empty($user->rights->tax->charges->lire)))){
+ // TODO Add a cache of loaded users here
+ $userstatic->fetch($userlinked_id);
+ print $userstatic->getNomUrl(1);
+ } else {
+ print ' ';
}
+
print ' ';
- if (!$i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Bank account
diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php
index c67c0496727..cb2e4915323 100644
--- a/htdocs/compta/bank/document.php
+++ b/htdocs/compta/bank/document.php
@@ -77,7 +77,7 @@ if ($object->id > 0)
$upload_dir = $conf->bank->dir_output."/".dol_sanitizeFileName($object->ref);
}
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php
index 14187bf51e3..1cd8d285eeb 100644
--- a/htdocs/compta/bank/various_payment/document.php
+++ b/htdocs/compta/bank/various_payment/document.php
@@ -66,7 +66,7 @@ $modulepart = 'banque';
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php
index 0790f149da4..3990c968806 100644
--- a/htdocs/compta/bank/various_payment/list.php
+++ b/htdocs/compta/bank/various_payment/list.php
@@ -251,7 +251,7 @@ if ($result)
if ($typeid > 0) $param .= '&typeid='.urlencode($typeid);
if ($search_amount_deb) $param .= '&search_amount_deb='.urlencode($search_amount_deb);
if ($search_amount_cred) $param .= '&search_amount_cred='.urlencode($search_amount_cred);
- if ($search_bank_account > 0) $param .= '&search_amount='.urlencode($search_bank_account);
+ if ($search_bank_account > 0) $param .= '&search_account='.urlencode($search_bank_account);
if ($search_accountancy_account > 0) $param .= '&search_accountancy_account='.urlencode($search_accountancy_account);
if ($search_accountancy_subledger > 0) $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger);
diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php
index 3dcbfc6519f..32a7e9bede5 100644
--- a/htdocs/compta/cashcontrol/report.php
+++ b/htdocs/compta/cashcontrol/report.php
@@ -111,7 +111,7 @@ $sql .= " WHERE pf.fk_facture = f.rowid AND p.rowid = pf.fk_paiement AND cp.id =
$sql .= " AND f.module_source = '".$db->escape($posmodule)."'";
$sql .= " AND f.pos_source = '".$db->escape($terminalid)."'";
$sql .= " AND f.paye = 1";
-$sql .= " AND p.entity IN (".getEntity('facture').")";
+$sql .= " AND p.entity = ".$conf->entity; // Never share entities for features related to accountancy
/*if ($key == 'cash') $sql.=" AND cp.code = 'LIQ'";
elseif ($key == 'cheque') $sql.=" AND cp.code = 'CHQ'";
elseif ($key == 'card') $sql.=" AND cp.code = 'CB'";
diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php
index 86d0dd383f1..c1e432f4b1a 100644
--- a/htdocs/compta/deplacement/document.php
+++ b/htdocs/compta/deplacement/document.php
@@ -71,7 +71,7 @@ $modulepart = 'trip';
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index ece75be8b3a..1d83bbd4b76 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -4756,7 +4756,7 @@ if ($action == 'create')
$paymentstatic->num_payment = $objp->num_payment;
$paymentstatic->payment_code = $objp->payment_code;
- print '';
+ print ' ';
print $paymentstatic->getNomUrl(1);
print ' ';
print '';
@@ -4785,7 +4785,7 @@ if ($action == 'create')
$bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
}
- print ' ';
+ print ' ';
if ($bankaccountstatic->id)
print $bankaccountstatic->getNomUrl(1, 'transactions');
print ' ';
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index 3922228c4fa..cbf6b045e85 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -79,7 +79,7 @@ if ($object->fetch($id))
* Actions
*/
-require_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 7b60dd639f6..249df885435 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -1376,7 +1376,7 @@ if ($resql)
// Alias
if (!empty($arrayfields['s.name_alias']['checked']))
{
- print '';
+ print ' ';
print $obj->name_alias;
print ' ';
if (!$i) $totalarray['nbfield']++;
diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index dc397d286cc..8a50619f17c 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -831,7 +831,7 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user
$sql .= ", s.nom as name, s.email";
$sql .= ", s.rowid as socid";
$sql .= ", s.code_client, s.code_compta";
- $sql .= ", c.rowid, c.ref, c.facture, c.fk_statut as status, c.total_ht, c.tva as total_tva, c.total_ttc,";
+ $sql .= ", c.rowid, c.ref, c.facture, c.fk_statut as status, c.total_ht, c.total_tva, c.total_ttc,";
$sql .= " cc.rowid as country_id, cc.code as country_code";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@@ -849,7 +849,7 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user
$reshook = $hookmanager->executeHooks('printFieldListWhereCustomerOrderToBill', $parameters);
$sql .= $hookmanager->resPrint;
- $sql .= " GROUP BY s.nom, s.email, s.rowid, s.code_client, s.code_compta, c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.tva, c.total_ttc, cc.rowid, cc.code";
+ $sql .= " GROUP BY s.nom, s.email, s.rowid, s.code_client, s.code_compta, c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.total_tva, c.total_ttc, cc.rowid, cc.code";
$resql = $db->query($sql);
if ($resql)
diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php
index b8bd1b6c564..8ea227482b1 100644
--- a/htdocs/compta/paiement.php
+++ b/htdocs/compta/paiement.php
@@ -508,19 +508,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print ''.$langs->trans('Numero');
print ' ('.$langs->trans("ChequeOrTransferNumber").') ';
print ' ';
- print ' ';
+ print ' ';
// Check transmitter
print ''.$langs->trans('CheckTransmitter');
print ' ('.$langs->trans("ChequeMaker").') ';
print ' ';
- print ' ';
+ print ' ';
// Bank name
print ''.$langs->trans('Bank');
print ' ('.$langs->trans("ChequeBank").') ';
print ' ';
- print ' ';
+ print ' ';
// Comments
print ''.$langs->trans('Comments').' ';
@@ -578,6 +578,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$i = 0;
//print '';
print ' ';
+
+ print ''; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '
';
print '';
@@ -786,7 +788,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print " \n";
}
print "
";
- //print "
\n";
+ print "\n";
}
$db->free($resql);
} else {
diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php
index b7f8d3c9a3d..3cedb27f07c 100644
--- a/htdocs/compta/paiement/card.php
+++ b/htdocs/compta/paiement/card.php
@@ -43,12 +43,22 @@ $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
+$object = new Paiement($db);
+// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+$hookmanager->initHooks(array('paymentcard', 'globalcard'));
+
+// Load object
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
+
+$result = restrictedArea($user, $object->element, $object->id, 'paiement', '');
+
// Security check
if ($user->socid) $socid = $user->socid;
-// TODO ajouter regle pour restreindre acces paiement
-//$result = restrictedArea($user, 'facture', $id,'');
-
-$object = new Paiement($db);
+// Now check also permission on thirdparty of invoices of payments. Thirdparty were loaded by the fetch_object before based on first invoice.
+// It should be enough because all payments are done on invoices of the same thirdparty.
+if ($socid && $socid != $object->thirdparty->id) {
+ accessforbidden();
+}
/*
@@ -59,7 +69,6 @@ if ($action == 'setnote' && $user->rights->facture->paiement)
{
$db->begin();
- $object->fetch($id);
$result = $object->update_note(GETPOST('note', 'restricthtml'));
if ($result > 0)
{
@@ -75,7 +84,6 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->
{
$db->begin();
- $object->fetch($id);
$result = $object->delete();
if ($result > 0)
{
@@ -100,7 +108,6 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture
{
$db->begin();
- $object->fetch($id);
if ($object->validate($user) > 0)
{
$db->commit();
@@ -134,7 +141,6 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture
if ($action == 'setnum_paiement' && !empty($_POST['num_paiement']))
{
- $object->fetch($id);
$res = $object->update_num($_POST['num_paiement']);
if ($res === 0)
{
@@ -146,7 +152,6 @@ if ($action == 'setnum_paiement' && !empty($_POST['num_paiement']))
if ($action == 'setdatep' && !empty($_POST['datepday']))
{
- $object->fetch($id);
$datepaye = dol_mktime(GETPOST('datephour', 'int'), GETPOST('datepmin', 'int'), GETPOST('datepsec', 'int'), GETPOST('datepmonth', 'int'), GETPOST('datepday', 'int'), GETPOST('datepyear', 'int'));
$res = $object->update_date($datepaye);
if ($res === 0)
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index 76b1dab5d83..842cb24a024 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -1294,7 +1294,8 @@ class Paiement extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Load the third party of object, from id into this->thirdparty
+ * Load the third party of object, from id into this->thirdparty.
+ * For payments, take the thirdparty linked to the first invoice found. This is enough because payments are done on invoices of the same thirdparty.
*
* @param int $force_thirdparty_id Force thirdparty id
* @return int <0 if KO, >0 if OK
diff --git a/htdocs/compta/paiement/info.php b/htdocs/compta/paiement/info.php
index 208d74a316f..ace21e40f95 100644
--- a/htdocs/compta/paiement/info.php
+++ b/htdocs/compta/paiement/info.php
@@ -36,6 +36,23 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
+$object = new Paiement($db);
+
+// Load object
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
+
+$result = restrictedArea($user, $object->element, $object->id, 'paiement', '');
+
+// Security check
+if ($user->socid) $socid = $user->socid;
+// Now check also permission on thirdparty of invoices of payments. Thirdparty were loaded by the fetch_object before based on first invoice.
+// It should be enough because all payments are done on invoices of the same thirdparty.
+if ($socid && $socid != $object->thirdparty->id) {
+ accessforbidden();
+}
+
+
+
/*
* Actions
*/
@@ -49,8 +66,6 @@ $confirm = GETPOST('confirm', 'alpha');
llxHeader('', $langs->trans("Payment"));
-$object = new Paiement($db);
-$object->fetch($id, $ref);
$object->info($object->id);
$head = payment_prepare_head($object);
diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php
index 47bb2ad2582..0af202016df 100644
--- a/htdocs/compta/paiement/rapport.php
+++ b/htdocs/compta/paiement/rapport.php
@@ -30,9 +30,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
-// Security check
-if (!$user->rights->facture->lire) accessforbidden();
-
$action = GETPOST('action', 'aZ09');
$socid = 0;
@@ -48,6 +45,9 @@ if (!$user->rights->societe->client->voir || $socid) $dir .= '/private/'.$user->
$year = GETPOST('year', 'int');
if (!$year) { $year = date("Y"); }
+// Security check
+if (empty($user->rights->facture->lire)) accessforbidden();
+
/*
* Actions
diff --git a/htdocs/compta/paiement/tovalidate.php b/htdocs/compta/paiement/tovalidate.php
index f6582a4ffb4..4cf14ad8a5c 100644
--- a/htdocs/compta/paiement/tovalidate.php
+++ b/htdocs/compta/paiement/tovalidate.php
@@ -27,10 +27,6 @@ require '../../main.inc.php';
// Load translation files required by the page
$langs->load("bills");
-// Security check
-if (!$user->rights->facture->lire)
- accessforbidden();
-
$socid = 0;
if ($user->socid > 0)
{
@@ -50,6 +46,9 @@ $pagenext = $page + 1;
if (!$sortorder) $sortorder = "DESC";
if (!$sortfield) $sortfield = "p.rowid";
+// Security check
+if (empty($user->rights->facture->lire)) accessforbidden();
+
/*
* Actions
diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php
index dbb01060a4d..d65f2cf7a3c 100644
--- a/htdocs/compta/sociales/document.php
+++ b/htdocs/compta/sociales/document.php
@@ -77,7 +77,7 @@ $modulepart = 'tax';
* Actions
*/
-require_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
if ($action == 'setlib' && $user->rights->tax->charges->creer)
{
diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php
index e310e61fcb8..addaf50d990 100644
--- a/htdocs/compta/tva/document.php
+++ b/htdocs/compta/tva/document.php
@@ -78,7 +78,7 @@ $modulepart = 'tax-vat';
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
if ($action == 'setlib' && $user->rights->tax->charges->creer)
{
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 0c4a683ae33..cd1db0bbc9a 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -2150,6 +2150,12 @@ if ($action == 'create')
$linktoelem = $form->showLinkToObjectBlock($object, null, array('contrat'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
+ // Show direct download link
+ if ($object->statut != Contrat::STATUS_DRAFT && !empty($conf->global->CONTRACT_ALLOW_EXTERNAL_DOWNLOAD))
+ {
+ print ' '."\n";
+ print showDirectDownloadLink($object).' ';
+ }
print '';
diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php
index ba15af0de19..dfdb0fe6d31 100644
--- a/htdocs/contrat/document.php
+++ b/htdocs/contrat/document.php
@@ -85,7 +85,7 @@ $hookmanager->initHooks(array('contractcard', 'globalcard'));
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php
index 9b020a05711..f13f7ffa1f9 100644
--- a/htdocs/core/boxes/box_commandes.php
+++ b/htdocs/core/boxes/box_commandes.php
@@ -98,7 +98,7 @@ class box_commandes extends ModeleBoxes
$sql .= ", c.fk_user_valid";
$sql .= ", c.facture";
$sql .= ", c.total_ht";
- $sql .= ", c.tva as total_tva";
+ $sql .= ", c.total_tva";
$sql .= ", c.total_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande as c";
diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php
index 6efd56c01db..747bae87cf7 100644
--- a/htdocs/core/boxes/box_propales.php
+++ b/htdocs/core/boxes/box_propales.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2003-2007 Rodolphe Quiedeville
* Copyright (C) 2004-2007 Laurent Destailleur
* Copyright (C) 2005-2009 Regis Houssin
- * Copyright (C) 2015-2019 Frederic France
+ * Copyright (C) 2015-2021 Frederic France
* Copyright (C) 2020 Pierre Ardoin
*
* This program is free software; you can redistribute it and/or modify
@@ -88,7 +88,7 @@ class box_propales extends ModeleBoxes
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.logo, s.email, s.entity";
- $sql .= ", p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms";
+ $sql .= ", p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.total_tva, p.total as total_ttc, p.tms";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index e7c209285ce..48d32a4e6a1 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -3231,9 +3231,13 @@ abstract class CommonObject
// Specific code for backward compatibility with old field names
if ($this->element == 'facture' || $this->element == 'facturerec') $fieldht = 'total';
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') $fieldtva = 'total_tva';
- if ($this->element == 'propal') $fieldttc = 'total';
+ if ($this->element == 'propal') {
+ $fieldttc = 'total';
+ $fieldtva = 'total_tva';
+ }
if ($this->element == 'expensereport') $fieldtva = 'total_tva';
- if ($this->element == 'supplier_proposal') $fieldttc = 'total';
+ if ($this->element == 'supplier_proposal') $fieldtva = 'total_tva';
+ if ($this->element == 'commande') $fieldtva = 'total_tva';
if (empty($nodatabaseupdate))
{
@@ -4885,6 +4889,9 @@ abstract class CommonObject
if ($this->element == 'bank_account' && !empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) {
$setsharekey = true;
}
+ if ($this->element == 'contrat' && !empty($conf->global->CONTRACT_ALLOW_EXTERNAL_DOWNLOAD)) {
+ $setsharekey = true;
+ }
if ($setsharekey) {
if (empty($ecmfile->share)) // Because object not found or share not set yet
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index 1eb3b9911ba..d8fbceeecf8 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -98,7 +98,7 @@ class Conf
public $dol_hide_leftmenu; // Set if we force param dol_hide_leftmenu into login url
public $dol_optimize_smallscreen; // Set if we force param dol_optimize_smallscreen into login url or if browser is smartphone
public $dol_no_mouse_hover; // Set if we force param dol_no_mouse_hover into login url or if browser is smartphone
- public $dol_use_jmobile; // Set if we force param dol_use_jmobile into login url
+ public $dol_use_jmobile; // Set if we force param dol_use_jmobile into login url. 0=default, 1=to say we use app from a webview app, 2=to say we use app from a webview app and keep ajax
public $liste_limit;
diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php
index 9f901ed3452..af336c38745 100644
--- a/htdocs/core/class/discount.class.php
+++ b/htdocs/core/class/discount.class.php
@@ -222,6 +222,7 @@ class DiscountAbsolute
if (empty($this->multicurrency_amount_ht)) $this->multicurrency_amount_ht = 0;
if (empty($this->multicurrency_amount_tva)) $this->multicurrency_amount_tva = 0;
if (empty($this->multicurrency_amount_ttc)) $this->multicurrency_amount_ttc = 0;
+ if (empty($this->tva_tx)) $this->tva_tx = 0;
// Check parameters
if (empty($this->description))
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 0057a7fba04..1abb7eb26e0 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -672,7 +672,7 @@ class Form
// Warning: if you set submit button to disabled, post using 'Enter' will no more work if there is no another input submit. So we add a hidden button
$ret .= ' '; // Hidden button BEFORE so it is the one used when we submit with ENTER.
- $ret .= ' ';
+ $ret .= ' use_javascript_ajax) ? '' : ' style="display: none"').' class="button'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'confirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">';
$ret .= '
';
if (!empty($conf->use_javascript_ajax))
@@ -5700,6 +5700,9 @@ class Form
if ($h == 3) $shour = '';
if ($m == 3) $smin = '';
+ $nowgmt = dol_now('gmt');
+ //var_dump(dol_print_date($nowgmt, 'dayhourinputnoreduce', 'tzuserrel'));
+
// You can set MAIN_POPUP_CALENDAR to 'eldy' or 'jquery'
$usecalendar = 'combo';
if (!empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) {
@@ -5722,13 +5725,13 @@ class Form
// Calendrier popup version eldy
if ($usecalendar == "eldy")
{
- // Zone de saisie manuelle de la date
+ // Input area to enter date manually
$retstring .= '
trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$retstring .= '>';
- // Icone calendar
+ // Icon calendar
$retstringbuttom = '';
if (!$disabled) {
$retstringbuttom = '
use_javascript_ajax && $adddateof)
{
$tmparray = dol_getdate($adddateof);
if (empty($labeladddateof)) $labeladddateof = $langs->trans("DateInvoice");
- $retstring .= ' - '.$labeladddateof.'';
+ $retstring .= ' - '.$labeladddateof.'';
}
return $retstring;
@@ -6301,7 +6301,7 @@ class Form
*/
public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0, $disabled = 0)
{
- global $conf, $langs, $user;
+ global $conf, $langs, $user, $hookmanager;
//print "$objecttmp->filter, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0, $disabled";
@@ -6347,27 +6347,34 @@ class Form
}
if ($objecttmp->ismultientitymanaged == 'fk_soc@societe')
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
- $sql .= " WHERE 1=1";
- if (isset($objecttmp->ismultientitymanaged) && $objecttmp->ismultientitymanaged == 1) $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
- if (isset($objecttmp->ismultientitymanaged) && !is_numeric($objecttmp->ismultientitymanaged)) {
- $sql .= ' AND parenttable.entity = t.'.$tmparray[0];
- }
- if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
- if ($objecttmp->element == 'societe') $sql .= " AND t.rowid = ".$user->socid;
- else $sql .= " AND t.fk_soc = ".$user->socid;
- }
- if ($searchkey != '') $sql .= natural_search(explode(',', $fieldstoshow), $searchkey);
- if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') {
- if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
- }
- if ($objecttmp->filter) { // Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
- /*if (! DolibarrApi::_checkFilters($objecttmp->filter))
- {
- throw new RestException(503, 'Error when validating parameter sqlfilters '.$objecttmp->filter);
- }*/
- $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
- $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'Form::forgeCriteriaCallback', $objecttmp->filter).")";
- }
+
+ // Add where from hooks
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('selectForFormsListWhere', $parameters); // Note that $action and $object may have been modified by hook
+ if (!empty($hookmanager->resPrint)) $sql .= $hookmanager->resPrint;
+ else {
+ $sql .= " WHERE 1=1";
+ if (isset($objecttmp->ismultientitymanaged) && $objecttmp->ismultientitymanaged == 1) $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
+ if (isset($objecttmp->ismultientitymanaged) && !is_numeric($objecttmp->ismultientitymanaged)) {
+ $sql .= ' AND parenttable.entity = t.'.$tmparray[0];
+ }
+ if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
+ if ($objecttmp->element == 'societe') $sql .= " AND t.rowid = ".$user->socid;
+ else $sql .= " AND t.fk_soc = ".$user->socid;
+ }
+ if ($searchkey != '') $sql .= natural_search(explode(',', $fieldstoshow), $searchkey);
+ if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') {
+ if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
+ }
+ if ($objecttmp->filter) { // Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
+ /*if (! DolibarrApi::_checkFilters($objecttmp->filter))
+ {
+ throw new RestException(503, 'Error when validating parameter sqlfilters '.$objecttmp->filter);
+ }*/
+ $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
+ $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'Form::forgeCriteriaCallback', $objecttmp->filter).")";
+ }
+ }
$sql .= $this->db->order($fieldstoshow, "ASC");
//$sql.=$this->db->plimit($limit, 0);
//print $sql;
@@ -6473,6 +6480,11 @@ class Form
$out = '';
+ if ($addjscombo < 0) {
+ if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $addjscombo = 1;
+ else $addjscombo = 0;
+ }
+
// Add code for jquery to use multiselect
if ($addjscombo && $jsbeautify) {
// Enhance with select2
diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php
index bfd5a6f64f7..92c697ceae7 100644
--- a/htdocs/core/class/html.formactions.class.php
+++ b/htdocs/core/class/html.formactions.class.php
@@ -20,7 +20,7 @@
/**
* \file htdocs/core/class/html.formactions.class.php
* \ingroup core
- * \brief Fichier de la classe des fonctions predefinie de composants html actions
+ * \brief File of class with predefined functions and HTML components
*/
@@ -355,7 +355,7 @@ class FormActions
if (!is_array($selected) && !empty($selected)) $selected = explode(',', $selected);
$out .= $form->multiselectarray($htmlname, $arraylist, $selected, 0, 0, 'centpercent', 0, 0);
} else {
- $out .= $form->selectarray($htmlname, $arraylist, $selected, 0, 0, 0, '', 0, 0, 0, '', 'minwidth200'.($morecss ? ' '.$morecss : ''), 1);
+ $out .= $form->selectarray($htmlname, $arraylist, $selected, 0, 0, 0, '', 0, 0, 0, '', 'minwidth300'.($morecss ? ' '.$morecss : ''), 1);
}
if ($user->admin && empty($onlyautoornot) && $hideinfohelp <= 0)
diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php
index 3e8eb04c430..36af8bfa875 100644
--- a/htdocs/core/class/html.formadmin.class.php
+++ b/htdocs/core/class/html.formadmin.class.php
@@ -77,7 +77,7 @@ class FormAdmin
if ($showempty && !$multiselect)
{
$out .= 'trans("AutoDetectLang").' ';
}
@@ -115,7 +115,7 @@ class FormAdmin
}
$valuetoshow .= ' '.picto_from_langcode($key, 'class="saturatemedium"');
- if ($selected == $keytouse) {
+ if ((string) $selected == (string) $keytouse) {
$out .= ''.$valuetoshow.' ';
} else {
$out .= ''.$valuetoshow.' ';
diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php
index e84a6716134..8cff096e56a 100644
--- a/htdocs/core/class/html.formcompany.class.php
+++ b/htdocs/core/class/html.formcompany.class.php
@@ -1029,11 +1029,10 @@ class FormCompany extends Form
public function formThirdpartyType($page, $selected = '', $htmlname = 'socid', $filter = '', $nooutput = 0)
{
// phpcs:enable
- global $langs;
+ global $conf, $langs;
$out = '';
- if ($htmlname != "none")
- {
+ if ($htmlname != "none") {
$out .= '';
} else {
- if ($selected)
- {
+ if ($selected) {
$arr = $this->typent_array(0);
$typent = $arr[$selected];
$out .= $typent;
@@ -1052,7 +1050,10 @@ class FormCompany extends Form
}
}
- if ($nooutput) return $out;
- else print $out;
+ if ($nooutput) {
+ return $out;
+ } else {
+ print $out;
+ }
}
}
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index c310c352690..c1837af4c56 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -247,6 +247,18 @@ class FormTicket
$doleditor->Create();
print '';
+ if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) {
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
+ print ''.$langs->trans("SecurityCode").' ';
+ print '';
+ print ' ';
+ print ' ';
+ print '';
+ print ' ';
+ print ''.img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"').' ';
+ print ' ';
+ print ' ';
+ }
// Attached files
if (!empty($this->withfile)) {
diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php
index a706d9a880e..c2850990ff5 100644
--- a/htdocs/core/class/translate.class.php
+++ b/htdocs/core/class/translate.class.php
@@ -460,7 +460,7 @@ class Translate
$tmparray = dol_getcache($usecachekey);
if (is_array($tmparray) && count($tmparray))
{
- $this->tab_translate += $tmparray; // Faster than array_merge($tmparray,$this->tab_translate). Note: If a valuer already exists into tab_translate, value into tmparaay is not added.
+ $this->tab_translate += $tmparray; // Faster than array_merge($tmparray,$this->tab_translate). Note: If a value already exists into tab_translate, value into tmparaay is not added.
//print $newdomain."\n";
//var_dump($this->tab_translate);
$fileread = 1;
diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php
index 382f12840d7..391a5359846 100644
--- a/htdocs/core/js/lib_head.js.php
+++ b/htdocs/core/js/lib_head.js.php
@@ -183,17 +183,18 @@ function getObjectFromID(id){
}
// Called after selection of a date to save details into detailed fields
-function dpChangeDay(dateFieldID,format)
+function dpChangeDay(dateFieldID, format)
{
//showDP.datefieldID=dateFieldID;
- console.log("Call dpChangeDay, we save date into detailed fields.");
+ console.log("Call dpChangeDay, we save date into detailed fields from format = "+format);
var thefield=getObjectFromID(dateFieldID);
var thefieldday=getObjectFromID(dateFieldID+"day");
var thefieldmonth=getObjectFromID(dateFieldID+"month");
var thefieldyear=getObjectFromID(dateFieldID+"year");
- var date=getDateFromFormat(thefield.value,format);
+ var date=getDateFromFormat(thefield.value, format);
+ //console.log(date);
if (date)
{
thefieldday.value=date.getDate();
diff --git a/htdocs/core/lib/asset.lib.php b/htdocs/core/lib/asset.lib.php
index 5fddf4f1c46..96355704c96 100644
--- a/htdocs/core/lib/asset.lib.php
+++ b/htdocs/core/lib/asset.lib.php
@@ -80,7 +80,7 @@ function asset_prepare_head(Asset $object)
$h = 0;
$head = array();
- $head[$h][0] = DOL_URL_ROOT.'/asset/card.php';
+ $head[$h][0] = DOL_URL_ROOT.'/asset/card.php?id='.$object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index a424657e206..310f34a86fb 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -7,7 +7,7 @@
* Copyright (C) 2013-2014 Juanjo Menent
* Copyright (C) 2013 Christophe Battarel
* Copyright (C) 2013-2018 Alexandre Spangaro
- * Copyright (C) 2015-2019 Frédéric France
+ * Copyright (C) 2015-2021 Frédéric France
* Copyright (C) 2015 Raphaël Doursenaud
* Copyright (C) 2017 Rui Strecht
* Copyright (C) 2018 Ferran Marcet
@@ -53,20 +53,32 @@ function societe_prepare_head(Societe $object)
if (empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) {
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->societe->contact->lire) {
//$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
- $nbContact = 0; // TODO
+ $nbContact = 0;
+ // Enable caching of thirdrparty count Contacts
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
+ $cachekey = 'count_contacts_thirdparty_'.$object->id;
+ $dataretrieved = dol_getcache($cachekey);
- $sql = "SELECT COUNT(p.rowid) as nb";
- $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
- $sql .= " WHERE p.fk_soc = ".$object->id;
- $resql = $db->query($sql);
- if ($resql) {
- $obj = $db->fetch_object($resql);
- if ($obj) $nbContact = $obj->nb;
+ if (!is_null($dataretrieved)) {
+ $nbContact = $dataretrieved;
+ } else {
+ $sql = "SELECT COUNT(p.rowid) as nb";
+ $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
+ $sql .= " WHERE p.fk_soc = ".$object->id;
+ $resql = $db->query($sql);
+ if ($resql) {
+ $obj = $db->fetch_object($resql);
+ $nbContact = $obj->nb;
+ }
+
+ dol_setcache($cachekey, $nbContact, 120); // If setting cache fails, this is not a problem, so we do not test result.
}
$head[$h][0] = DOL_URL_ROOT.'/societe/contact.php?socid='.$object->id;
$head[$h][1] = $langs->trans('ContactsAddresses');
- if ($nbContact > 0) $head[$h][1] .= ''.$nbContact.' ';
+ if ($nbContact > 0) {
+ $head[$h][1] .= ''.$nbContact.' ';
+ }
$head[$h][2] = 'contact';
$h++;
}
@@ -74,7 +86,9 @@ function societe_prepare_head(Societe $object)
$head[$h][0] = DOL_URL_ROOT.'/societe/societecontact.php?socid='.$object->id;
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
$head[$h][1] = $langs->trans("ContactsAddresses");
- if ($nbContact > 0) $head[$h][1] .= ''.$nbContact.' ';
+ if ($nbContact > 0) {
+ $head[$h][1] .= ''.$nbContact.' ';
+ }
$head[$h][2] = 'contact';
$h++;
}
@@ -82,9 +96,15 @@ function societe_prepare_head(Societe $object)
if ($object->client == 1 || $object->client == 2 || $object->client == 3) {
$head[$h][0] = DOL_URL_ROOT.'/comm/card.php?socid='.$object->id;
$head[$h][1] = '';
- if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && ($object->client == 2 || $object->client == 3)) $head[$h][1] .= $langs->trans("Prospect");
- if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && $object->client == 3) $head[$h][1] .= ' | ';
- if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && ($object->client == 1 || $object->client == 3)) $head[$h][1] .= $langs->trans("Customer");
+ if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && ($object->client == 2 || $object->client == 3)) {
+ $head[$h][1] .= $langs->trans("Prospect");
+ }
+ if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && $object->client == 3) {
+ $head[$h][1] .= ' | ';
+ }
+ if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && ($object->client == 1 || $object->client == 3)) {
+ $head[$h][1] .= $langs->trans("Customer");
+ }
$head[$h][2] = 'customer';
$h++;
@@ -98,7 +118,9 @@ function societe_prepare_head(Societe $object)
}
}
$supplier_module_enabled = 0;
- if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) $supplier_module_enabled = 1;
+ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
+ $supplier_module_enabled = 1;
+ }
if ($supplier_module_enabled == 1 && $object->fournisseur && !empty($user->rights->fournisseur->lire)) {
$head[$h][0] = DOL_URL_ROOT.'/fourn/card.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Supplier");
@@ -107,26 +129,33 @@ function societe_prepare_head(Societe $object)
}
if (!empty($conf->projet->enabled) && (!empty($user->rights->projet->lire))) {
+ $nbProject = 0;
+ // Enable caching of thirdrparty count projects
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
+ $cachekey = 'count_projects_thirdparty_'.$object->id;
+ $dataretrieved = dol_getcache($cachekey);
+
+ if (!is_null($dataretrieved)) {
+ $nbProject = $dataretrieved;
+ } else {
+ $sql = "SELECT COUNT(n.rowid) as nb";
+ $sql .= " FROM ".MAIN_DB_PREFIX."projet as n";
+ $sql .= " WHERE fk_soc = ".$object->id;
+ $sql .= " AND entity IN (".getEntity('project').")";
+ $resql = $db->query($sql);
+ if ($resql) {
+ $obj = $db->fetch_object($resql);
+ $nbProject = $obj->nb;
+ } else {
+ dol_print_error($db);
+ }
+ dol_setcache($cachekey, $nbProject, 120); // If setting cache fails, this is not a problem, so we do not test result.
+ }
$head[$h][0] = DOL_URL_ROOT.'/societe/project.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Projects");
- $nbNote = 0;
- $sql = "SELECT COUNT(n.rowid) as nb";
- $sql .= " FROM ".MAIN_DB_PREFIX."projet as n";
- $sql .= " WHERE fk_soc = ".$object->id;
- $sql .= " AND entity IN (".getEntity('project').")";
- $resql = $db->query($sql);
- if ($resql) {
- $num = $db->num_rows($resql);
- $i = 0;
- while ($i < $num) {
- $obj = $db->fetch_object($resql);
- $nbNote = $obj->nb;
- $i++;
- }
- } else {
- dol_print_error($db);
+ if ($nbProject > 0) {
+ $head[$h][1] .= ''.$nbProject.' ';
}
- if ($nbNote > 0) $head[$h][1] .= ''.$nbNote.' ';
$head[$h][2] = 'project';
$h++;
}
@@ -180,12 +209,16 @@ function societe_prepare_head(Societe $object)
//$title = $langs->trans("BankAccountsAndGateways");
$servicestatus = 0;
- if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) $servicestatus = 1;
+ if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) {
+ $servicestatus = 1;
+ }
include_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php';
$societeaccount = new SocieteAccount($db);
$stripecu = $societeaccount->getCustomerAccount($object->id, 'stripe', $servicestatus); // Get thirdparty cu_...
- if ($stripecu) $foundonexternalonlinesystem++;
+ if ($stripecu) {
+ $foundonexternalonlinesystem++;
+ }
}
$sql = "SELECT COUNT(n.rowid) as nb";
@@ -199,13 +232,8 @@ function societe_prepare_head(Societe $object)
$resql = $db->query($sql);
if ($resql) {
- $num = $db->num_rows($resql);
- $i = 0;
- while ($i < $num) {
- $obj = $db->fetch_object($resql);
- $nbBankAccount = $obj->nb;
- $i++;
- }
+ $obj = $db->fetch_object($resql);
+ $nbBankAccount = $obj->nb;
} else {
dol_print_error($db);
}
@@ -214,8 +242,11 @@ function societe_prepare_head(Societe $object)
$head[$h][0] = DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id;
$head[$h][1] = $title;
- if ($foundonexternalonlinesystem) $head[$h][1] .= '... ';
- elseif ($nbBankAccount > 0) $head[$h][1] .= ''.$nbBankAccount.' ';
+ if ($foundonexternalonlinesystem) {
+ $head[$h][1] .= '... ';
+ } elseif ($nbBankAccount > 0) {
+ $head[$h][1] .= ''.$nbBankAccount.' ';
+ }
$head[$h][2] = 'rib';
$h++;
}
@@ -229,17 +260,14 @@ function societe_prepare_head(Societe $object)
$sql .= " WHERE fk_soc = ".$object->id.' AND fk_website > 0';
$resql = $db->query($sql);
if ($resql) {
- $num = $db->num_rows($resql);
- $i = 0;
- while ($i < $num) {
- $obj = $db->fetch_object($resql);
- $nbNote = $obj->nb;
- $i++;
- }
+ $obj = $db->fetch_object($resql);
+ $nbNote = $obj->nb;
} else {
dol_print_error($db);
}
- if ($nbNote > 0) $head[$h][1] .= ''.$nbNote.' ';
+ if ($nbNote > 0) {
+ $head[$h][1] .= ''.$nbNote.' ';
+ }
$head[$h][2] = 'website';
$h++;
}
@@ -253,50 +281,75 @@ function societe_prepare_head(Societe $object)
if ($user->socid == 0) {
// Notifications
if (!empty($conf->notification->enabled)) {
- $nbNote = 0;
- $sql = "SELECT COUNT(n.rowid) as nb";
- $sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n";
- $sql .= " WHERE fk_soc = ".$object->id;
- $resql = $db->query($sql);
- if ($resql) {
- $num = $db->num_rows($resql);
- $i = 0;
- while ($i < $num) {
- $obj = $db->fetch_object($resql);
- $nbNote = $obj->nb;
- $i++;
- }
+ $nbNotif = 0;
+ // Enable caching of thirdrparty count notifications
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
+ $cachekey = 'count_notifications_thirdparty_'.$object->id;
+ $dataretrieved = dol_getcache($cachekey);
+ if (!is_null($dataretrieved)) {
+ $nbNotif = $dataretrieved;
} else {
- dol_print_error($db);
+ $sql = "SELECT COUNT(n.rowid) as nb";
+ $sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n";
+ $sql .= " WHERE fk_soc = ".$object->id;
+ $resql = $db->query($sql);
+ if ($resql) {
+ $obj = $db->fetch_object($resql);
+ $nbNotif = $obj->nb;
+ } else {
+ dol_print_error($db);
+ }
+ dol_setcache($cachekey, $nbNotif, 120); // If setting cache fails, this is not a problem, so we do not test result.
}
$head[$h][0] = DOL_URL_ROOT.'/societe/notify/card.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Notifications");
- if ($nbNote > 0) $head[$h][1] .= ''.$nbNote.' ';
+ if ($nbNotif > 0) {
+ $head[$h][1] .= ''.$nbNotif.' ';
+ }
$head[$h][2] = 'notify';
$h++;
}
// Notes
$nbNote = 0;
- if (!empty($object->note_private)) $nbNote++;
- if (!empty($object->note_public)) $nbNote++;
+ if (!empty($object->note_private)) {
+ $nbNote++;
+ }
+ if (!empty($object->note_public)) {
+ $nbNote++;
+ }
$head[$h][0] = DOL_URL_ROOT.'/societe/note.php?id='.$object->id;
$head[$h][1] = $langs->trans("Notes");
- if ($nbNote > 0) $head[$h][1] .= ''.$nbNote.' ';
+ if ($nbNote > 0) {
+ $head[$h][1] .= ''.$nbNote.' ';
+ }
$head[$h][2] = 'note';
$h++;
- // Attached files
- require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
- require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
- $upload_dir = $conf->societe->multidir_output[$object->entity]."/".$object->id;
- $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
- $nbLinks = Link::count($db, $object->element, $object->id);
+ // Attached files and Links
+ $totalAttached = 0;
+ // Enable caching of thirdrparty count attached files and links
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
+ $cachekey = 'count_attached_thirdparty_'.$object->id;
+ $dataretrieved = dol_getcache($cachekey);
+ if (!is_null($dataretrieved)) {
+ $totalAttached = $dataretrieved;
+ } else {
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+ require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
+ $upload_dir = $conf->societe->multidir_output[$object->entity]."/".$object->id;
+ $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
+ $nbLinks = Link::count($db, $object->element, $object->id);
+ $totalAttached = $nbFiles + $nbLinks;
+ dol_setcache($cachekey, $totalAttached, 120); // If setting cache fails, this is not a problem, so we do not test result.
+ }
$head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Documents");
- if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ''.($nbFiles + $nbLinks).' ';
+ if (($totalAttached) > 0) {
+ $head[$h][1] .= ''.($totalAttached).' ';
+ }
$head[$h][2] = 'document';
$h++;
}
@@ -304,17 +357,41 @@ function societe_prepare_head(Societe $object)
$head[$h][0] = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Events");
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
+ $nbEvent = 0;
+ // Enable caching of thirdrparty count actioncomm
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
+ $cachekey = 'count_events_thirdparty_'.$object->id;
+ $dataretrieved = dol_getcache($cachekey);
+ if (!is_null($dataretrieved)) {
+ $nbEvent = $dataretrieved;
+ } else {
+ $sql = "SELECT COUNT(id) as nb";
+ $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm";
+ $sql .= " WHERE fk_soc = ".$object->id;
+ $resql = $db->query($sql);
+ if ($resql) {
+ $obj = $db->fetch_object($resql);
+ $nbEvent = $obj->nb;
+ } else {
+ dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
+ }
+ dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result.
+ }
+
$head[$h][1] .= '/';
$head[$h][1] .= $langs->trans("Agenda");
+ if ($nbEvent > 0) {
+ $head[$h][1] .= ''.$nbEvent.' ';
+ }
}
$head[$h][2] = 'agenda';
$h++;
// Log
/*$head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$object->id;
- $head[$h][1] = $langs->trans("Info");
- $head[$h][2] = 'info';
- $h++;*/
+ $head[$h][1] = $langs->trans("Info");
+ $head[$h][2] = 'info';
+ $h++;*/
complete_head_from_modules($conf, $langs, $object, $head, $h, 'thirdparty', 'remove');
@@ -412,16 +489,27 @@ function getCountry($searchkey, $withcode = '', $dbtouse = 0, $outputlangs = '',
// Check parameters
if (empty($searchkey) && empty($searchlabel)) {
- if ($withcode === 'all') return array('id'=>'', 'code'=>'', 'label'=>'');
- else return '';
+ if ($withcode === 'all') {
+ return array('id'=>'', 'code'=>'', 'label'=>'');
+ } else {
+ return '';
+ }
+ }
+ if (!is_object($dbtouse)) {
+ $dbtouse = $db;
+ }
+ if (!is_object($outputlangs)) {
+ $outputlangs = $langs;
}
- if (!is_object($dbtouse)) $dbtouse = $db;
- if (!is_object($outputlangs)) $outputlangs = $langs;
$sql = "SELECT rowid, code, label FROM ".MAIN_DB_PREFIX."c_country";
- if (is_numeric($searchkey)) $sql .= " WHERE rowid=".$searchkey;
- elseif (!empty($searchkey)) $sql .= " WHERE code='".$db->escape($searchkey)."'";
- else $sql .= " WHERE label='".$db->escape($searchlabel)."'";
+ if (is_numeric($searchkey)) {
+ $sql .= " WHERE rowid=".$searchkey;
+ } elseif (!empty($searchkey)) {
+ $sql .= " WHERE code='".$db->escape($searchkey)."'";
+ } else {
+ $sql .= " WHERE label='".$db->escape($searchlabel)."'";
+ }
$resql = $dbtouse->query($sql);
if ($resql) {
@@ -433,17 +521,25 @@ function getCountry($searchkey, $withcode = '', $dbtouse = 0, $outputlangs = '',
if ($entconv) $label = ($obj->code && ($outputlangs->trans("Country".$obj->code) != "Country".$obj->code)) ? $outputlangs->trans("Country".$obj->code) : $label;
else $label = ($obj->code && ($outputlangs->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code)) ? $outputlangs->transnoentitiesnoconv("Country".$obj->code) : $label;
}
- if ($withcode == 1) $result = $label ? "$obj->code - $label" : "$obj->code";
- elseif ($withcode == 2) $result = $obj->code;
- elseif ($withcode == 3) $result = $obj->rowid;
- elseif ($withcode === 'all') $result = array('id'=>$obj->rowid, 'code'=>$obj->code, 'label'=>$label);
- else $result = $label;
+ if ($withcode == 1) {
+ $result = $label ? "$obj->code - $label" : "$obj->code";
+ } elseif ($withcode == 2) {
+ $result = $obj->code;
+ } elseif ($withcode == 3) {
+ $result = $obj->rowid;
+ } elseif ($withcode === 'all') {
+ $result = array('id'=>$obj->rowid, 'code'=>$obj->code, 'label'=>$label);
+ } else {
+ $result = $label;
+ }
} else {
$result = 'NotDefined';
}
$dbtouse->free($resql);
return $result;
- } else dol_print_error($dbtouse, '');
+ } else {
+ dol_print_error($dbtouse, '');
+ }
return 'Error';
}
@@ -466,7 +562,9 @@ function getState($id, $withcode = '', $dbtouse = 0, $withregion = 0, $outputlan
{
global $db, $langs;
- if (!is_object($dbtouse)) $dbtouse = $db;
+ if (!is_object($dbtouse)) {
+ $dbtouse = $db;
+ }
$sql = "SELECT d.rowid as id, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code, r.code_region as region_code, r.nom as region_name FROM";
$sql .= " ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r,".MAIN_DB_PREFIX."c_country as c";
@@ -529,7 +627,9 @@ function currency_name($code_iso, $withcode = '', $outputlangs = null)
{
global $langs, $db;
- if (empty($outputlangs)) $outputlangs = $langs;
+ if (empty($outputlangs)) {
+ $outputlangs = $langs;
+ }
$outputlangs->load("dict");
@@ -549,8 +649,11 @@ function currency_name($code_iso, $withcode = '', $outputlangs = null)
if ($num) {
$obj = $db->fetch_object($resql);
$label = ($obj->label != '-' ? $obj->label : '');
- if ($withcode) return ($label == $code_iso) ? "$code_iso" : "$code_iso - $label";
- else return $label;
+ if ($withcode) {
+ return ($label == $code_iso) ? "$code_iso" : "$code_iso - $label";
+ } else {
+ return $label;
+ }
} else {
return $code_iso;
}
@@ -895,8 +998,8 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$search_status = '';
- $search_name = '';
- $search_roles = array();
+ $search_name = '';
+ $search_roles = array();
$search_address = '';
$search_poste = '';
$search = array();
@@ -989,7 +1092,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
} elseif (in_array($key, array('role'))) {
print $formcompany->showRoles("search_roles", $contactstatic, 'edit', $search_roles);
} else {
- print ' ';
+ print ' ';
}
print '';
}
@@ -1260,14 +1363,27 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$sql .= " a.fk_contact,";
$sql .= " c.code as acode, c.libelle as alabel, c.picto as apicto,";
$sql .= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
- if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur'))) $sql .= ", sp.lastname, sp.firstname";
- elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') { /* Nothing */ } elseif (is_object($filterobj) && get_class($filterobj) == 'Project') { /* Nothing */ } elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql .= ", m.lastname, m.firstname";
- elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql .= ", o.ref";
- elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql .= ", o.ref";
- elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql .= ", o.ref";
- elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') $sql .= ", o.ref";
- elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') $sql .= ", o.ref";
- elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && is_array($filterobj->fields['ref']) && $filterobj->table_element && $filterobj->element) $sql .= ", o.ref";
+ if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur'))) {
+ $sql .= ", sp.lastname, sp.firstname";
+ } elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') {
+ /* Nothing */
+ } elseif (is_object($filterobj) && get_class($filterobj) == 'Project') {
+ /* Nothing */
+ } elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') {
+ $sql .= ", m.lastname, m.firstname";
+ } elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') {
+ $sql .= ", o.ref";
+ } elseif (is_object($filterobj) && get_class($filterobj) == 'Product') {
+ $sql .= ", o.ref";
+ } elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') {
+ $sql .= ", o.ref";
+ } elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') {
+ $sql .= ", o.ref";
+ } elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
+ $sql .= ", o.ref";
+ } elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && is_array($filterobj->fields['ref']) && $filterobj->table_element && $filterobj->element) {
+ $sql .= ", o.ref";
+ }
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
@@ -1286,7 +1402,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$sql .= " ON er.resource_type = 'dolresource'";
$sql .= " AND er.element_id = a.id";
$sql .= " AND er.resource_id = ".$filterobj->id;
- } elseif (is_object($filterobj) && get_class($filterobj) == 'Project') { /* Nothing */ } elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql .= ", ".MAIN_DB_PREFIX."adherent as m";
+ } elseif (is_object($filterobj) && get_class($filterobj) == 'Project') {
+ /* Nothing */
+ } elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql .= ", ".MAIN_DB_PREFIX."adherent as m";
elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql .= ", ".MAIN_DB_PREFIX."product as o";
elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql .= ", ".MAIN_DB_PREFIX."ticket as o";
diff --git a/htdocs/core/lib/cron.lib.php b/htdocs/core/lib/cron.lib.php
index fda122be7bf..9702c8ab1dc 100644
--- a/htdocs/core/lib/cron.lib.php
+++ b/htdocs/core/lib/cron.lib.php
@@ -99,10 +99,10 @@ function dol_print_cron_urls()
// Cron launch
print '';
print $langs->trans("URLToLaunchCronJobs").':
';
- $url = $urlwithroot.'/public/cron/cron_run_jobs.php?'.(empty($conf->global->CRON_KEY) ? '' : 'securitykey='.$conf->global->CRON_KEY.'&').'userlogin='.$user->login;
+ $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').'
'.$url." \n";
print ' '.$langs->trans("OrToLaunchASpecificJob").'
';
- $url = $urlwithroot.'/public/cron/cron_run_jobs.php?'.(empty($conf->global->CRON_KEY) ? '' : 'securitykey='.$conf->global->CRON_KEY.'&').'userlogin='.$user->login.'&id=cronjobid';
+ $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').'
'.$url." \n";
print '
';
print ' ';
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index d57e2d02ed3..0d440271c47 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -1970,7 +1970,7 @@ function dol_strftime($fmt, $ts = false, $is_gmt = false)
* "%d/%m/%Y %H:%M",
* "%d/%m/%Y %H:%M:%S",
* "%B"=Long text of month, "%A"=Long text of day, "%b"=Short text of month, "%a"=Short text of day
- * "day", "daytext", "dayhour", "dayhourldap", "dayhourtext", "dayrfc", "dayhourrfc", "...reduceformat"
+ * "day", "daytext", "dayhour", "dayhourldap", "dayhourtext", "dayrfc", "dayhourrfc", "...inputnoreduce", "...reduceformat"
* @param string $tzoutput true or 'gmt' => string is for Greenwich location
* false or 'tzserver' => output string is for local PHP server TZ usage
* 'tzuser' => output string is for user TZ (current browser TZ with current dst) => In a future, we should have same behaviour than 'tzuserrel'
@@ -2014,13 +2014,17 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
}
if (!is_object($outputlangs)) $outputlangs = $langs;
if (!$format) $format = 'daytextshort';
- $reduceformat = (!empty($conf->dol_optimize_smallscreen) && in_array($format, array('day', 'dayhour'))) ? 1 : 0;
+
+ // Do we have to reduce the length of date (year on 2 chars) to save space.
+ // Note: dayinputnoreduce is same than day but no reduction of year length will be done
+ $reduceformat = (!empty($conf->dol_optimize_smallscreen) && in_array($format, array('day', 'dayhour'))) ? 1 : 0; // Test on original $format param.
+ $format = preg_replace('/inputnoreduce/', '', $format); // so format 'dayinputnoreduce' is processed like day
$formatwithoutreduce = preg_replace('/reduceformat/', '', $format);
if ($formatwithoutreduce != $format) { $format = $formatwithoutreduce; $reduceformat = 1; } // so format 'dayreduceformat' is processed like day
// Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default.
// TODO Add format daysmallyear and dayhoursmallyear
- if ($format == 'day') $format = ($outputlangs->trans("FormatDateShort") != "FormatDateShort" ? $outputlangs->trans("FormatDateShort") : $conf->format_date_short);
+ if ($format == 'day') $format = ($outputlangs->trans("FormatDateShort") != "FormatDateShort" ? $outputlangs->trans("FormatDateShort") : $conf->format_date_short);
elseif ($format == 'hour') $format = ($outputlangs->trans("FormatHourShort") != "FormatHourShort" ? $outputlangs->trans("FormatHourShort") : $conf->format_hour_short);
elseif ($format == 'hourduration') $format = ($outputlangs->trans("FormatHourShortDuration") != "FormatHourShortDuration" ? $outputlangs->trans("FormatHourShortDuration") : $conf->format_hour_short_duration);
elseif ($format == 'daytext') $format = ($outputlangs->trans("FormatDateText") != "FormatDateText" ? $outputlangs->trans("FormatDateText") : $conf->format_date_text);
@@ -2446,21 +2450,32 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64,
function getArrayOfSocialNetworks()
{
global $conf, $db;
- $sql = "SELECT rowid, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
- $sql .= " WHERE entity=".$conf->entity;
+
$socialnetworks = array();
- $resql = $db->query($sql);
- if ($resql) {
- while ($obj = $db->fetch_object($resql)) {
- $socialnetworks[$obj->code] = array(
- 'rowid' => $obj->rowid,
- 'label' => $obj->label,
- 'url' => $obj->url,
- 'icon' => $obj->icon,
- 'active' => $obj->active,
- );
+ // Enable caching of array
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
+ $cachekey = 'socialnetworks_' . $conf->entity;
+ $dataretrieved = dol_getcache($cachekey);
+ if (!is_null($dataretrieved)) {
+ $socialnetworks = $dataretrieved;
+ } else {
+ $sql = "SELECT rowid, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
+ $sql .= " WHERE entity=".$conf->entity;
+ $resql = $db->query($sql);
+ if ($resql) {
+ while ($obj = $db->fetch_object($resql)) {
+ $socialnetworks[$obj->code] = array(
+ 'rowid' => $obj->rowid,
+ 'label' => $obj->label,
+ 'url' => $obj->url,
+ 'icon' => $obj->icon,
+ 'active' => $obj->active,
+ );
+ }
}
+ dol_setcache($cachekey, $socialnetworks); // If setting cache fails, this is not a problem, so we do not test result.
}
+
return $socialnetworks;
}
@@ -3169,15 +3184,15 @@ function dol_substr($string, $start, $length, $stringencoding = '', $trunconbyte
/**
- * Truncate a string to a particular length adding '...' if string larger than length.
- * If length = max length+1, we do no truncate to avoid having just 1 char replaced with '...'.
+ * Truncate a string to a particular length adding '…' if string larger than length.
+ * If length = max length+1, we do no truncate to avoid having just 1 char replaced with '…'.
* MAIN_DISABLE_TRUNC=1 can disable all truncings
*
* @param string $string String to truncate
- * @param int $size Max string size visible (excluding ...). 0 for no limit. WARNING: Final string size can have 3 more chars (if we added ..., or if size was max+1 or max+2 or max+3 so it does not worse to replace with ...)
+ * @param int $size Max string size visible (excluding …). 0 for no limit. WARNING: Final string size can have 3 more chars (if we added …, or if size was max+1 so it does not worse to replace with ...)
* @param string $trunc Where to trunc: 'right', 'left', 'middle' (size must be a 2 power), 'wrap'
* @param string $stringencoding Tell what is source string encoding
- * @param int $nodot Truncation do not add ... after truncation. So it's an exact truncation.
+ * @param int $nodot Truncation do not add … after truncation. So it's an exact truncation.
* @param int $display Trunc is used to display data and can be changed for small screen. TODO Remove this param (must be dealt with CSS)
* @return string Truncated string. WARNING: length is never higher than $size if $nodot is set, but can be 3 chars higher otherwise.
*/
@@ -3185,42 +3200,53 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF
{
global $conf;
- if ($size == 0 || !empty($conf->global->MAIN_DISABLE_TRUNC)) return $string;
+ if ($size == 0 || !empty($conf->global->MAIN_DISABLE_TRUNC)) {
+ return $string;
+ }
- if (empty($stringencoding)) $stringencoding = 'UTF-8';
+ if (empty($stringencoding)) {
+ $stringencoding = 'UTF-8';
+ }
// reduce for small screen
if ($conf->dol_optimize_smallscreen == 1 && $display == 1) $size = round($size / 3);
// We go always here
- if ($trunc == 'right')
- {
- $newstring = dol_textishtml($string) ?dol_string_nohtmltag($string, 1) : $string;
- if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ...
- return dol_substr($newstring, 0, $size, $stringencoding).($nodot ? '' : '...');
- else //return 'u'.$size.'-'.$newstring.'-'.dol_strlen($newstring,$stringencoding).'-'.$string;
- return $string;
- } elseif ($trunc == 'middle')
- {
- $newstring = dol_textishtml($string) ?dol_string_nohtmltag($string, 1) : $string;
- if (dol_strlen($newstring, $stringencoding) > 2 && dol_strlen($newstring, $stringencoding) > ($size + 1))
- {
+ if ($trunc == 'right') {
+ $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string;
+ if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 1))) {
+ // If nodot is 0 and size is 1 chars more, we don't trunc and don't add …
+ return dol_substr($newstring, 0, $size, $stringencoding).($nodot ? '' : '…');
+ } else {
+ //return 'u'.$size.'-'.$newstring.'-'.dol_strlen($newstring,$stringencoding).'-'.$string;
+ return $string;
+ }
+ } elseif ($trunc == 'middle') {
+ $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string;
+ if (dol_strlen($newstring, $stringencoding) > 2 && dol_strlen($newstring, $stringencoding) > ($size + 1)) {
$size1 = round($size / 2);
$size2 = round($size / 2);
- return dol_substr($newstring, 0, $size1, $stringencoding).'...'.dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size2, $size2, $stringencoding);
- } else return $string;
- } elseif ($trunc == 'left')
- {
- $newstring = dol_textishtml($string) ?dol_string_nohtmltag($string, 1) : $string;
- if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ...
- return '...'.dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size, $size, $stringencoding);
- else return $string;
- } elseif ($trunc == 'wrap')
- {
- $newstring = dol_textishtml($string) ?dol_string_nohtmltag($string, 1) : $string;
- if (dol_strlen($newstring, $stringencoding) > ($size + 1))
- return dol_substr($newstring, 0, $size, $stringencoding)."\n".dol_trunc(dol_substr($newstring, $size, dol_strlen($newstring, $stringencoding) - $size, $stringencoding), $size, $trunc);
- else return $string;
- } else return 'BadParam3CallingDolTrunc';
+ return dol_substr($newstring, 0, $size1, $stringencoding).'…'.dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size2, $size2, $stringencoding);
+ } else {
+ return $string;
+ }
+ } elseif ($trunc == 'left') {
+ $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string;
+ if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 1))) {
+ // If nodot is 0 and size is 1 chars more, we don't trunc and don't add …
+ return '…'.dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size, $size, $stringencoding);
+ } else {
+ return $string;
+ }
+ } elseif ($trunc == 'wrap') {
+ $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string;
+ if (dol_strlen($newstring, $stringencoding) > ($size + 1)) {
+ return dol_substr($newstring, 0, $size, $stringencoding)."\n".dol_trunc(dol_substr($newstring, $size, dol_strlen($newstring, $stringencoding) - $size, $stringencoding), $size, $trunc);
+ } else {
+ return $string;
+ }
+ } else {
+ return 'BadParam3CallingDolTrunc';
+ }
}
/**
@@ -3265,7 +3291,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$pictowithouttext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto);
if (empty($srconly) && in_array($pictowithouttext, array(
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
- 'accountancy', 'account', 'accountline', 'action', 'add', 'address', 'bank_account', 'barcode', 'bank', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'building',
+ 'accountancy', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'bank_account', 'barcode', 'bank', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'building',
'cash-register', 'category', 'check', 'clock', 'close_title', 'cog', 'company', 'contact', 'contract', 'cron', 'cubes',
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'edit', 'ellipsis-h', 'email', 'eraser', 'external-link-alt', 'external-link-square-alt',
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'group',
@@ -3292,7 +3318,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp',
'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies',
'generic', 'home', 'hrm', 'members', 'products', 'invoicing',
- 'payment', 'pencil-ruler', 'preview', 'project', 'projectpub', 'refresh', 'salary', 'supplier_invoice', 'technic', 'ticket',
+ 'payment', 'pencil-ruler', 'preview', 'project', 'projectpub', 'refresh', 'salary', 'shipment', 'supplier_invoice', 'technic', 'ticket',
'error', 'warning',
'recruitmentcandidature', 'recruitmentjobposition', 'resource',
'shapes', 'supplier_proposal', 'supplier_order', 'supplier_invoice', 'user-cog',
@@ -3371,10 +3397,13 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$fakey = 'fa-'.$pictowithouttext;
}
- if (in_array($pictowithouttext, array('member', 'members', 'contract', 'group', 'resource'))) {
+ if (in_array($pictowithouttext, array('holiday', 'dollyrevert', 'member', 'members', 'contract', 'group', 'resource', 'shipment'))) {
$morecss = 'em092';
}
- if (in_array($pictowithouttext, array('intervention', 'payment', 'loan', 'technic'))) {
+ if (in_array($pictowithouttext, array('holiday'))) {
+ $morecss = 'em088';
+ }
+ if (in_array($pictowithouttext, array('intervention', 'payment', 'loan', 'stock', 'technic'))) {
$morecss = 'em080';
}
@@ -6248,17 +6277,19 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
)
);
- $substitutionarray = array_merge($substitutionarray, array(
- '__USER_ID__' => (string) $user->id,
- '__USER_LOGIN__' => (string) $user->login,
- '__USER_EMAIL__' => (string) $user->email,
- '__USER_LASTNAME__' => (string) $user->lastname,
- '__USER_FIRSTNAME__' => (string) $user->firstname,
- '__USER_FULLNAME__' => (string) $user->getFullName($outputlangs),
- '__USER_SUPERVISOR_ID__' => (string) ($user->fk_user ? $user->fk_user : '0'),
- '__USER_REMOTE_IP__' => (string) getUserRemoteIP()
- )
+ if (is_object($user)) {
+ $substitutionarray = array_merge($substitutionarray, array(
+ '__USER_ID__' => (string) $user->id,
+ '__USER_LOGIN__' => (string) $user->login,
+ '__USER_EMAIL__' => (string) $user->email,
+ '__USER_LASTNAME__' => (string) $user->lastname,
+ '__USER_FIRSTNAME__' => (string) $user->firstname,
+ '__USER_FULLNAME__' => (string) $user->getFullName($outputlangs),
+ '__USER_SUPERVISOR_ID__' => (string) ($user->fk_user ? $user->fk_user : '0'),
+ '__USER_REMOTE_IP__' => (string) getUserRemoteIP()
+ )
);
+ }
}
if ((empty($exclude) || !in_array('mycompany', $exclude)) && is_object($mysoc))
{
@@ -6272,7 +6303,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
'__MYCOMPANY_PROFID5__' => $mysoc->idprof5,
'__MYCOMPANY_PROFID6__' => $mysoc->idprof6,
'__MYCOMPANY_CAPITAL__' => $mysoc->capital,
- '__MYCOMPANY_FULLADDRESS__' => $mysoc->getFullAddress(1, ', '),
+ '__MYCOMPANY_FULLADDRESS__' => (method_exists($mysoc, 'getFullAddress') ? $mysoc->getFullAddress(1, ', ') : ''), // $mysoc may be stdClass
'__MYCOMPANY_ADDRESS__' => $mysoc->address,
'__MYCOMPANY_ZIP__' => $mysoc->zip,
'__MYCOMPANY_TOWN__' => $mysoc->town,
@@ -6553,6 +6584,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
if (is_object($object) && $object->element == 'commande') $typeforonlinepayment = 'order';
if (is_object($object) && $object->element == 'facture') $typeforonlinepayment = 'invoice';
if (is_object($object) && $object->element == 'member') $typeforonlinepayment = 'member';
+ if (is_object($object) && $object->element == 'contrat') $typeforonlinepayment = 'contract';
$url = getOnlinePaymentUrl(0, $typeforonlinepayment, $substitutionarray['__REF__']);
$paymenturl = $url;
}
@@ -6574,10 +6606,15 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
{
$substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = $object->getLastMainDocLink($object->element);
} else $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = '';
+ if (!empty($conf->global->CONTRACT_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'contrat')
+ {
+ $substitutionarray['__DIRECTDOWNLOAD_URL_CONTRACT__'] = $object->getLastMainDocLink($object->element);
+ } else $substitutionarray['__DIRECTDOWNLOAD_URL_CONTRACT__'] = '';
if (is_object($object) && $object->element == 'propal') $substitutionarray['__URL_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/comm/propal/card.php?id=".$object->id;
if (is_object($object) && $object->element == 'commande') $substitutionarray['__URL_ORDER__'] = DOL_MAIN_URL_ROOT."/commande/card.php?id=".$object->id;
if (is_object($object) && $object->element == 'facture') $substitutionarray['__URL_INVOICE__'] = DOL_MAIN_URL_ROOT."/compta/facture/card.php?id=".$object->id;
+ if (is_object($object) && $object->element == 'contrat') $substitutionarray['__URL_CONTRACT__'] = DOL_MAIN_URL_ROOT."/contrat/card.php?id=".$object->id;
}
if (is_object($object) && $object->element == 'action')
diff --git a/htdocs/core/lib/memory.lib.php b/htdocs/core/lib/memory.lib.php
index 7b863391b24..484b3933e42 100644
--- a/htdocs/core/lib/memory.lib.php
+++ b/htdocs/core/lib/memory.lib.php
@@ -1,5 +1,6 @@
+ * Copyright (C) 2021 Frédéric France
*
* 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
@@ -23,11 +24,34 @@
global $shmkeys, $shmoffset;
-$shmkeys = array('main'=>1, 'admin'=>2, 'dict'=>3, 'companies'=>4, 'suppliers'=>5, 'products'=>6,
- 'commercial'=>7, 'compta'=>8, 'projects'=>9, 'cashdesk'=>10, 'agenda'=>11, 'bills'=>12,
- 'propal'=>13, 'boxes'=>14, 'banks'=>15, 'other'=>16, 'errors'=>17, 'members'=>18, 'ecm'=>19,
- 'orders'=>20, 'users'=>21, 'help'=>22, 'stocks'=>23, 'interventions'=>24,
- 'donations'=>25, 'contracts'=>26);
+$shmkeys = array(
+ 'main' => 1,
+ 'admin' => 2,
+ 'dict' => 3,
+ 'companies' => 4,
+ 'suppliers' => 5,
+ 'products' => 6,
+ 'commercial' => 7,
+ 'compta' => 8,
+ 'projects' => 9,
+ 'cashdesk' => 10,
+ 'agenda' => 11,
+ 'bills' => 12,
+ 'propal' => 13,
+ 'boxes' => 14,
+ 'banks' => 15,
+ 'other' => 16,
+ 'errors' => 17,
+ 'members' => 18,
+ 'ecm' => 19,
+ 'orders' => 20,
+ 'users' => 21,
+ 'help' => 22,
+ 'stocks' => 23,
+ 'interventions' => 24,
+ 'donations' => 25,
+ 'contracts' => 26,
+);
$shmoffset = 1000; // Max number of entries found into a language file. If too low, some entries will be overwritten.
@@ -36,60 +60,60 @@ $shmoffset = 1000; // Max number of entries found into a language file. If too l
* Save data into a memory area shared by all users, all sessions on server
*
* @param string $memoryid Memory id of shared area
- * @param string $data Data to save
- * @return int <0 if KO, Nb of bytes written if OK
+ * @param mixed $data Data to save. It must not be a null value.
+ * @param int $expire ttl in seconds, 0 never expire
+ * @return int <0 if KO, 0 if nothing is done, Nb of bytes written if OK
+ * @see dol_getcache()
*/
-function dol_setcache($memoryid, $data)
+function dol_setcache($memoryid, $data, $expire = 0)
{
global $conf;
$result = 0;
- // Using a memcached server
- if (!empty($conf->memcached->enabled) && class_exists('Memcached'))
- {
- global $dolmemcache;
- if (empty($dolmemcache) || !is_object($dolmemcache))
- {
- $dolmemcache = new Memcached();
- $tmparray = explode(':', $conf->global->MEMCACHED_SERVER);
- $result = $dolmemcache->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211);
- if (!$result) return -1;
- }
+ if (strpos($memoryid, 'count_') === 0) { // The memoryid key start with 'count_...'
+ if (empty($conf->global->MAIN_CACHE_COUNT)) return 0;
+ }
- $memoryid = session_name().'_'.$memoryid;
+ if (!empty($conf->memcached->enabled) && class_exists('Memcached')) {
+ // Using a memcached server
+ global $dolmemcache;
+ if (empty($dolmemcache) || !is_object($dolmemcache)) {
+ $dolmemcache = new Memcached();
+ $tmparray = explode(':', $conf->global->MEMCACHED_SERVER);
+ $result = $dolmemcache->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211);
+ if (!$result) return -1;
+ }
+
+ $memoryid = session_name() . '_' . $memoryid;
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
- $dolmemcache->add($memoryid, $data); // This fails if key already exists
+ $dolmemcache->add($memoryid, $data, $expire); // This fails if key already exists
$rescode = $dolmemcache->getResultCode();
- if ($rescode == 0)
- {
+ if ($rescode == 0) {
return count($data);
} else {
return -$rescode;
}
- } elseif (!empty($conf->memcached->enabled) && class_exists('Memcache'))
- {
+ } elseif (!empty($conf->memcached->enabled) && class_exists('Memcache')) { // This is a really not reliable cache ! Use Memcached instead.
+ // Using a memcache server
global $dolmemcache;
- if (empty($dolmemcache) || !is_object($dolmemcache))
- {
- $dolmemcache = new Memcache();
- $tmparray = explode(':', $conf->global->MEMCACHED_SERVER);
- $result = $dolmemcache->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211);
- if (!$result) return -1;
- }
+ if (empty($dolmemcache) || !is_object($dolmemcache)) {
+ $dolmemcache = new Memcache();
+ $tmparray = explode(':', $conf->global->MEMCACHED_SERVER);
+ $result = $dolmemcache->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211);
+ if (!$result) return -1;
+ }
- $memoryid = session_name().'_'.$memoryid;
+ $memoryid = session_name() . '_' . $memoryid;
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
- $result = $dolmemcache->add($memoryid, $data); // This fails if key already exists
- if ($result)
- {
+ $result = $dolmemcache->add($memoryid, $data, false, $expire); // This fails if key already exists
+ if ($result) {
return count($data);
} else {
return -1;
}
- } // Using shmop
- elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02))
- {
- $result = dol_setshmop($memoryid, $data);
+ } elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) { // This is a really not reliable cache ! Use Memcached instead.
+ // Using shmop
+ $result = dol_setshmop($memoryid, $data, $expire);
}
return $result;
@@ -99,67 +123,67 @@ function dol_setcache($memoryid, $data)
* Read a memory area shared by all users, all sessions on server
*
* @param string $memoryid Memory id of shared area
- * @return int <0 if KO, data if OK
+ * @return int|mixed <0 if KO, data if OK, null if not found into cache or no caching feature enabled
+ * @see dol_setcache()
*/
function dol_getcache($memoryid)
{
global $conf;
- // Using a memcached server
- if (!empty($conf->memcached->enabled) && class_exists('Memcached'))
- {
- global $m;
- if (empty($m) || !is_object($m))
- {
- $m = new Memcached();
- $tmparray = explode(':', $conf->global->MEMCACHED_SERVER);
- $result = $m->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211);
- if (!$result) return -1;
- }
+ if (strpos($memoryid, 'count_') === 0) { // The memoryid key start with 'count_...'
+ if (empty($conf->global->MAIN_CACHE_COUNT)) return null;
+ }
- $memoryid = session_name().'_'.$memoryid;
+ // Using a memcached server
+ if (!empty($conf->memcached->enabled) && class_exists('Memcached')) {
+ global $m;
+ if (empty($m) || !is_object($m)) {
+ $m = new Memcached();
+ $tmparray = explode(':', $conf->global->MEMCACHED_SERVER);
+ $result = $m->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211);
+ if (!$result) return -1;
+ }
+
+ $memoryid = session_name() . '_' . $memoryid;
//$m->setOption(Memcached::OPT_COMPRESSION, false);
//print "Get memoryid=".$memoryid;
$data = $m->get($memoryid);
$rescode = $m->getResultCode();
- //print "memoryid=".$memoryid." - rescode=".$rescode." - data=".count($data)."\n ";
+ //print "memoryid=".$memoryid." - rescode=".$rescode." - count(response)=".count($data)."\n ";
//var_dump($data);
- if ($rescode == 0)
- {
+ if ($rescode == 0) {
return $data;
+ } elseif ($rescode == 16) { // = Memcached::MEMCACHED_NOTFOUND but this constant doe snot exists.
+ return null;
} else {
return -$rescode;
}
- } elseif (!empty($conf->memcached->enabled) && class_exists('Memcache'))
- {
+ } elseif (!empty($conf->memcached->enabled) && class_exists('Memcache')) { // This is a really not reliable cache ! Use Memcached instead.
global $m;
- if (empty($m) || !is_object($m))
- {
- $m = new Memcache();
- $tmparray = explode(':', $conf->global->MEMCACHED_SERVER);
- $result = $m->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211);
- if (!$result) return -1;
- }
+ if (empty($m) || !is_object($m)) {
+ $m = new Memcache();
+ $tmparray = explode(':', $conf->global->MEMCACHED_SERVER);
+ $result = $m->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211);
+ if (!$result) return -1;
+ }
- $memoryid = session_name().'_'.$memoryid;
+ $memoryid = session_name() . '_' . $memoryid;
//$m->setOption(Memcached::OPT_COMPRESSION, false);
$data = $m->get($memoryid);
//print "memoryid=".$memoryid." - rescode=".$rescode." - data=".count($data)."\n ";
//var_dump($data);
- if ($data)
- {
+ if ($data) {
return $data;
} else {
- return -1;
+ return null; // There is no way to make a difference between NOTFOUND and error when using Memcache. So do not use it, use Memcached instead.
}
- } // Using shmop
- elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02))
- {
+ } elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) { // This is a really not reliable cache ! Use Memcached instead.
+ // Using shmop
$data = dol_getshmop($memoryid);
return $data;
}
- return 0;
+ return null;
}
@@ -173,7 +197,9 @@ function dol_getcache($memoryid)
function dol_getshmopaddress($memoryid)
{
global $shmkeys, $shmoffset;
- if (empty($shmkeys[$memoryid])) return 0;
+ if (empty($shmkeys[$memoryid])) { // No room reserved for thid memoryid, no way to use cache
+ return 0;
+ }
return $shmkeys[$memoryid] + $shmoffset;
}
@@ -187,10 +213,11 @@ function dol_listshmop()
global $shmkeys, $shmoffset;
$resarray = array();
- foreach ($shmkeys as $key => $val)
- {
+ foreach ($shmkeys as $key => $val) {
$result = dol_getshmop($key);
- if (!is_numeric($result) || $result > 0) $resarray[$key] = $result;
+ if (!is_numeric($result) || $result > 0) {
+ $resarray[$key] = $result;
+ }
}
return $resarray;
}
@@ -199,32 +226,33 @@ function dol_listshmop()
* Save data into a memory area shared by all users, all sessions on server
*
* @param int $memoryid Memory id of shared area ('main', 'agenda', ...)
- * @param string $data Data to save
- * @return int <0 if KO, Nb of bytes written if OK
+ * @param string $data Data to save. Must be a not null value.
+ * @param int $expire ttl in seconds, 0 never expire
+ * @return int <0 if KO, 0=Caching not available, Nb of bytes written if OK
*/
-function dol_setshmop($memoryid, $data)
+function dol_setshmop($memoryid, $data, $expire)
{
global $shmkeys, $shmoffset;
//print 'dol_setshmop memoryid='.$memoryid." \n";
if (empty($shmkeys[$memoryid]) || !function_exists("shmop_write")) return 0;
$shmkey = dol_getshmopaddress($memoryid);
+ if (empty($shmkey)) return 0; // No key reserved for this memoryid, we can't cache this memoryid
+
$newdata = serialize($data);
$size = strlen($newdata);
//print 'dol_setshmop memoryid='.$memoryid." shmkey=".$shmkey." newdata=".$size."bytes \n";
$handle = shmop_open($shmkey, 'c', 0644, 6 + $size);
- if ($handle)
- {
+ if ($handle) {
$shm_bytes_written1 = shmop_write($handle, str_pad($size, 6), 0);
$shm_bytes_written2 = shmop_write($handle, $newdata, 6);
- if (($shm_bytes_written1 + $shm_bytes_written2) != (6 + dol_strlen($newdata)))
- {
- print "Couldn't write the entire length of data\n";
+ if (($shm_bytes_written1 + $shm_bytes_written2) != (6 + dol_strlen($newdata))) {
+ print "Couldn't write the entire length of data\n";
}
shmop_close($handle);
return ($shm_bytes_written1 + $shm_bytes_written2);
} else {
- print 'Error in shmop_open for memoryid='.$memoryid.' shmkey='.$shmkey.' 6+size=6+'.$size;
+ print 'Error in shmop_open for memoryid=' . $memoryid . ' shmkey=' . $shmkey . ' 6+size=6+' . $size;
return -1;
}
}
@@ -233,24 +261,29 @@ function dol_setshmop($memoryid, $data)
* Read a memory area shared by all users, all sessions on server
*
* @param string $memoryid Memory id of shared area ('main', 'agenda', ...)
- * @return int <0 if KO, data if OK
+ * @return int <0 if KO, data if OK, Null if no cache enabled or not found
*/
function dol_getshmop($memoryid)
{
global $shmkeys, $shmoffset;
- if (empty($shmkeys[$memoryid]) || !function_exists("shmop_open")) return 0;
+ $data = null;
+
+ if (empty($shmkeys[$memoryid]) || !function_exists("shmop_open")) {
+ return null;
+ }
$shmkey = dol_getshmopaddress($memoryid);
+ if (empty($shmkey)) return null; // No key reserved for this memoryid, we can't cache this memoryid
+
//print 'dol_getshmop memoryid='.$memoryid." shmkey=".$shmkey." \n";
$handle = @shmop_open($shmkey, 'a', 0, 0);
- if ($handle)
- {
+ if ($handle) {
$size = trim(shmop_read($handle, 0, 6));
if ($size) $data = unserialize(shmop_read($handle, 6, $size));
else return -1;
shmop_close($handle);
} else {
- return -2;
+ return null; // Can't open existing block, so we suppose it was not created, so nothing were cached yet for the memoryid
}
return $data;
}
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index 4602e877bd1..9d18dd1dd85 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -165,6 +165,7 @@ function dol_verifyHash($chain, $hash, $type = '0')
/**
* Check permissions of a user to show a page and an object. Check read permission.
* If GETPOST('action','aZ09') defined, we also check write and delete permission.
+ * This method check permission on module then call checkUserAccessToObject() for permission on object (according to entity and socid of user).
*
* @param User $user User to check
* @param string $features Features to check (it must be module $object->element. Examples: 'societe', 'contact', 'produit&service', 'produit|service', ...)
@@ -175,20 +176,22 @@ function dol_verifyHash($chain, $hash, $type = '0')
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
* @param int $isdraft 1=The object with id=$objectid is a draft
* @return int Always 1, die process if not allowed
- * @see dol_check_secure_access_document()
+ * @see dol_check_secure_access_document(), checkUserAccessToObject()
*/
function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid', $isdraft = 0)
{
global $db, $conf;
global $hookmanager;
- //dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename,$feature2,$dbt_socfield,$dbt_select");
+ //dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft");
//print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid;
//print ", dbtablename=".$dbtablename.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select;
//print ", perm: ".$features."->".$feature2."=".($user->rights->$features->$feature2->lire)." ";
$parentfortableentity = '';
+ // Fix syntax of $features param
+ $originalfeatures = $features;
if ($features == 'facturerec') $features = 'facture';
if ($features == 'mo') $features = 'mrp';
if ($features == 'member') $features = 'adherent';
@@ -198,7 +201,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
if ($features == 'product') $features = 'produit';
// Get more permissions checks from hooks
- $parameters = array('features'=>$features, 'objectid'=>$objectid, 'idtype'=>$dbt_select);
+ $parameters = array('features'=>$features, 'originalfeatures'=>$originalfeatures, 'objectid'=>$objectid, 'dbt_select'=>$dbt_select, 'idtype'=>$dbt_select, 'isdraft'=>$isdraft);
$reshook = $hookmanager->executeHooks('restrictedArea', $parameters);
if (isset($hookmanager->resArray['result'])) {
@@ -218,11 +221,6 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
// More subfeatures to check
if (!empty($feature2)) $feature2 = explode("|", $feature2);
- // More parameters
- $params = explode('&', $tableandshare);
- $dbtablename = (!empty($params[0]) ? $params[0] : '');
- $sharedelement = (!empty($params[1]) ? $params[1] : $dbtablename);
-
$listofmodules = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
// Check read permission from module
@@ -247,6 +245,10 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
if (!$user->rights->banque->cheque) { $readok = 0; $nbko++; }
} elseif ($feature == 'projet') {
if (!$user->rights->projet->lire && !$user->rights->projet->all->lire) { $readok = 0; $nbko++; }
+ } elseif ($feature == 'payment') {
+ if (!$user->rights->facture->lire) { $readok = 0; $nbko++; }
+ } elseif ($feature == 'payment_supplier') {
+ if (!$user->rights->fournisseur->facture->lire) { $readok = 0; $nbko++; }
} elseif (!empty($feature2)) { // This is for permissions on 2 levels
$tmpreadok = 1;
foreach ($feature2 as $subfeature) {
@@ -426,6 +428,10 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
{
global $db, $conf;
+ //dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft");
+ //print "user_id=".$user->id.", features=".join(',', $featuresarray).", feature2=".$feature2.", objectid=".$objectid;
+ //print ", tableandshare=".$tableandshare.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select." ";
+
// More parameters
$params = explode('&', $tableandshare);
$dbtablename = (!empty($params[0]) ? $params[0] : '');
@@ -440,13 +446,13 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
if ($feature == 'project') $feature = 'projet';
if ($feature == 'task') $feature = 'projet_task';
- $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'website'); // Test on entity only (Objects with no link to company)
+ $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'website'); // Test on entity only (Objects with no link to company)
$checksoc = array('societe'); // Test for societe object
- $checkother = array('contact', 'agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...).
+ $checkother = array('contact', 'agenda'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...).
$checkproject = array('projet', 'project'); // Test for project object
$checktask = array('projet_task'); // Test for task object
$nocheck = array('barcode', 'stock'); // No test
- //$checkdefault = 'all other not already defined'; // Test on entity and link to third party. Not allowed if link is empty (Ex: invoice, orders...).
+ //$checkdefault = 'all other not already defined'; // Test on entity + link to third party on field $dbt_keyfield. Not allowed if link is empty (Ex: invoice, orders...).
// If dbtablename not defined, we use same name for table than module name
if (empty($dbtablename))
@@ -455,17 +461,14 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
$sharedelement = (!empty($params[1]) ? $params[1] : $dbtablename); // We change dbtablename, so we set sharedelement too.
}
- // Check permission for object with entity
+ // Check permission for object on entity only
if (in_array($feature, $check))
{
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
- if (($feature == 'user' || $feature == 'usergroup') && !empty($conf->multicompany->enabled))
- {
- if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
- {
- if ($conf->entity == 1 && $user->admin && !$user->entity)
- {
+ if (($feature == 'user' || $feature == 'usergroup') && !empty($conf->multicompany->enabled)) { // Special for multicompany
+ if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
+ if ($conf->entity == 1 && $user->admin && !$user->entity) {
$sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
$sql .= " AND dbt.entity IS NOT NULL";
} else {
@@ -490,15 +493,12 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
}
}
- } elseif (in_array($feature, $checksoc)) // We check feature = checksoc
- {
- // If external user: Check permission for external users
- if ($user->socid > 0)
- {
+ } elseif (in_array($feature, $checksoc)) { // We check feature = checksoc
+ if ($user->socid > 0) {
+ // If external user: Check permission for external users
if ($user->socid <> $objectid) return false;
- } // If internal user: Check permission for internal users that are restricted on their objects
- elseif (!empty($conf->societe->enabled) && ($user->rights->societe->lire && !$user->rights->societe->client->voir))
- {
+ } elseif (!empty($conf->societe->enabled) && ($user->rights->societe->lire && !$user->rights->societe->client->voir)) {
+ // If internal user: Check permission for internal users that are restricted on their objects
$sql = "SELECT COUNT(sc.fk_soc) as nb";
$sql .= " FROM (".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= ", ".MAIN_DB_PREFIX."societe as s)";
@@ -506,15 +506,14 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
$sql .= " AND sc.fk_user = ".$user->id;
$sql .= " AND sc.fk_soc = s.rowid";
$sql .= " AND s.entity IN (".getEntity($sharedelement, 1).")";
- } // If multicompany and internal users with all permissions, check user is in correct entity
- elseif (!empty($conf->multicompany->enabled))
- {
+ } elseif (!empty($conf->multicompany->enabled)) {
+ // If multicompany and internal users with all permissions, check user is in correct entity
$sql = "SELECT COUNT(s.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE s.rowid IN (".$objectid.")";
$sql .= " AND s.entity IN (".getEntity($sharedelement, 1).")";
}
- } elseif (in_array($feature, $checkother)) // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...).
+ } elseif (in_array($feature, $checkother)) // Test on entity + link to thirdparty. Allowed if link is empty (Ex: contacts...).
{
// If external user: Check permission for external users
if ($user->socid > 0)
diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php
index 75a20ac6852..07112ed66d9 100644
--- a/htdocs/core/lib/website.lib.php
+++ b/htdocs/core/lib/website.lib.php
@@ -205,7 +205,7 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0, $c
/**
* Render a string of an HTML content and output it.
- * Used to ouput the page when viewed from server (Dolibarr or Apache).
+ * Used to ouput the page when viewed from a server (Dolibarr or Apache).
*
* @param string $content Content string
* @param string $contenttype Content type
@@ -231,7 +231,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
- if (defined('USEDOLIBARREDITOR')) // REPLACEMENT OF LINKS When page called from Dolibarr editor
+ if (defined('USEDOLIBARREDITOR')) // REPLACEMENT OF LINKS When page called from Dolibarr editor (this case should not happen)
{
// We remove the part of content
if ($contenttype == 'html')
@@ -296,7 +296,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
if (empty($includehtmlcontentopened)) {
$content = str_replace('!~!~!~', '', $content);
}
- } else // REPLACEMENT OF LINKS When page called from virtual host
+ } else // REPLACEMENT OF LINKS When page called from virtual host web server
{
$symlinktomediaexists = 1;
if ($website->virtualhost) {
@@ -355,7 +355,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
}
}
- $content = str_replace(' contenteditable="true"', ' contenteditable="false"', $content);
+ //$content = str_replace(' contenteditable="true"', ' contenteditable="false"', $content);
if (!empty($conf->global->WEBSITE_ADD_CSS_TO_BODY)) {
$content = str_replace('trans("MenuListAssets"), 1, $user->rights->asset->read);
$newmenu->add("/asset/type.php?leftmenu=asset_type", $langs->trans("MenuTypeAssets"), 1, $user->rights->asset->read, '', $mainmenu, 'asset_type');
if ($usemenuhider || empty($leftmenu) || preg_match('/asset_type/', $leftmenu)) {
- $newmenu->add("/asset/type.php?leftmenu=asset_type&action=create", $langs->trans("MenuNewTypeAssets"), 2, (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->setup_advance));
+ $newmenu->add("/asset/type.php?leftmenu=asset_type&action=create", $langs->trans("MenuNewTypeAssets"), 2, $user->rights->asset->setup_advance);
$newmenu->add("/asset/type.php?leftmenu=asset_type", $langs->trans("MenuListTypeAssets"), 2, $user->rights->asset->read);
}
}
@@ -1535,7 +1537,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if ($mainmenu == 'products') {
// Products
if (!empty($conf->product->enabled)) {
- $newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->rights->produit->lire, '', $mainmenu, 'product');
+ $newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->rights->produit->lire, '', $mainmenu, 'product', 0, '', '', '', img_picto('', 'product', 'class="pictofixedwidth"'));
$newmenu->add("/product/card.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer);
$newmenu->add("/product/list.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->rights->produit->lire);
if (!empty($conf->stock->enabled)) {
@@ -1563,7 +1565,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Services
if (!empty($conf->service->enabled)) {
- $newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->rights->service->lire, '', $mainmenu, 'service');
+ $newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->rights->service->lire, '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="pictofixedwidth"'));
$newmenu->add("/product/card.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->rights->service->creer);
$newmenu->add("/product/list.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->rights->service->lire);
if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled)) {
@@ -1580,7 +1582,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Warehouse
if (!empty($conf->stock->enabled)) {
$langs->load("stocks");
- $newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock');
+ $newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"'));
$newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer);
$newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->rights->stock->lire);
$newmenu->add("/product/stock/movement_list.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire);
@@ -1602,7 +1604,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if (!empty($conf->stock->enabled)) {
$langs->load("stocks");
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
- $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock');
+ $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"'));
if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") {
$newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->creer);
$newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->lire);
@@ -1620,7 +1622,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Shipments
if (!empty($conf->expedition->enabled)) {
$langs->load("sendings");
- $newmenu->add("/expedition/index.php?leftmenu=sendings", $langs->trans("Shipments"), 0, $user->rights->expedition->lire, '', $mainmenu, 'sendings');
+ $newmenu->add("/expedition/index.php?leftmenu=sendings", $langs->trans("Shipments"), 0, $user->rights->expedition->lire, '', $mainmenu, 'sendings', 0, '', '', '', img_picto('', 'shipment', 'class="pictofixedwidth"'));
$newmenu->add("/expedition/card.php?action=create2&leftmenu=sendings", $langs->trans("NewSending"), 1, $user->rights->expedition->creer);
$newmenu->add("/expedition/list.php?leftmenu=sendings", $langs->trans("List"), 1, $user->rights->expedition->lire);
if ($usemenuhider || empty($leftmenu) || $leftmenu == "sendings") {
@@ -1634,7 +1636,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Receptions
if (!empty($conf->reception->enabled)) {
$langs->load("receptions");
- $newmenu->add("/reception/index.php?leftmenu=receptions", $langs->trans("Receptions"), 0, $user->rights->reception->lire, '', $mainmenu, 'receptions');
+ $newmenu->add("/reception/index.php?leftmenu=receptions", $langs->trans("Receptions"), 0, $user->rights->reception->lire, '', $mainmenu, 'receptions', 0, '', '', '', img_picto('', 'dollyrevert', 'class="pictofixedwidth"'));
$newmenu->add("/reception/card.php?action=create2&leftmenu=receptions", $langs->trans("NewReception"), 1, $user->rights->reception->creer);
$newmenu->add("/reception/list.php?leftmenu=receptions", $langs->trans("List"), 1, $user->rights->reception->lire);
if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") {
@@ -1700,7 +1702,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
}
// Project assigned to user
- $newmenu->add("/projet/index.php?leftmenu=projects".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titleboth, 0, $user->rights->projet->lire, '', $mainmenu, 'projects');
+ $newmenu->add("/projet/index.php?leftmenu=projects".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titleboth, 0, $user->rights->projet->lire, '', $mainmenu, 'projects', 0, '', '', '', img_picto('', 'project', 'class="pictofixedwidth"'));
$newmenu->add("/projet/card.php?leftmenu=projects&action=create".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titlenew, 1, $user->rights->projet->creer);
if ($conf->global->PROJECT_USE_OPPORTUNITIES == 0) {
@@ -1723,7 +1725,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
// Project affected to user
- $newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->rights->projet->lire, '', 'project', 'tasks');
+ $newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->rights->projet->lire, '', 'project', 'tasks', 0, '', '', '', img_picto('', 'task', 'class="pictofixedwidth"'));
$newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire);
@@ -1741,7 +1743,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if (!empty($conf->hrm->enabled)) {
$langs->load("hrm");
- $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->hrm->employee->read, '', $mainmenu, 'hrm');
+ $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->hrm->employee->read, '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'user', 'class="pictofixedwidth"'));
$newmenu->add("/user/card.php?mainmenu=hrm&leftmenu=hrm&action=create&employee=1", $langs->trans("NewEmployee"), 1, $user->rights->hrm->employee->write);
$newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1, $user->rights->hrm->employee->read);
}
@@ -1751,7 +1753,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Load translation files required by the page
$langs->loadLangs(array("holiday", "trips"));
- $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm');
+ $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'holiday', 'class="pictofixedwidth"'));
$newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=create", $langs->trans("New"), 1, $user->rights->holiday->write);
$newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("List"), 1, $user->rights->holiday->read);
if ($usemenuhider || empty($leftmenu) || $leftmenu == "hrm") {
diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php
index 6c0bcc0f4b1..5b2e339a588 100644
--- a/htdocs/core/modules/import/import_xlsx.modules.php
+++ b/htdocs/core/modules/import/import_xlsx.modules.php
@@ -173,7 +173,7 @@ class ImportXlsx extends ModeleImports
$this->workbook->getActiveSheet()->getStyle('1')->getFont()->setBold(true);
$this->workbook->getActiveSheet()->getStyle('1')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT);
- $col = 0;
+ $col = 1;
foreach ($headerlinefields as $field) {
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($col, 1, $outputlangs->transnoentities($field));
// set autowidth
@@ -195,7 +195,7 @@ class ImportXlsx extends ModeleImports
public function write_record_example($outputlangs, $contentlinevalues)
{
// phpcs:enable
- $col = 0;
+ $col = 1;
$row = 2;
foreach ($contentlinevalues as $cell) {
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($col, $row, $cell);
@@ -289,7 +289,7 @@ class ImportXlsx extends ModeleImports
$xlsx = new Xlsx();
$info = $xlsx->listWorksheetinfo($this->file);
$countcolumns = $info[0]['totalColumns'];
- for ($col = 0; $col < $countcolumns; $col++) {
+ for ($col = 1; $col <= $countcolumns; $col++) {
$this->headers[$col] = $this->workbook->getActiveSheet()->getCellByColumnAndRow($col, 1)->getValue();
}
return 0;
@@ -314,7 +314,7 @@ class ImportXlsx extends ModeleImports
$xlsx = new Xlsx();
$info = $xlsx->listWorksheetinfo($this->file);
$countcolumns = $info[0]['totalColumns'];
- for ($col = 0; $col < $countcolumns; $col++) {
+ for ($col = 1; $col <= $countcolumns; $col++) {
$val = $this->workbook->getActiveSheet()->getCellByColumnAndRow($col, $this->record)->getValue();
$array[$col]['val'] = $val;
$array[$col]['type'] = (dol_strlen($val) ? 1 : -1); // If empty we consider it null
@@ -372,7 +372,7 @@ class ImportXlsx extends ModeleImports
//var_dump($sort_array_match_file_to_database);
- if (count($arrayrecord) == 0 || (count($arrayrecord) == 1 && empty($arrayrecord[0]['val']))) {
+ if (count($arrayrecord) == 0 || (count($arrayrecord) == 1 && empty($arrayrecord[1]['val']))) {
//print 'W';
$this->warnings[$warning]['lib'] = $langs->trans('EmptyLine');
$this->warnings[$warning]['type'] = 'EMPTY';
@@ -420,7 +420,7 @@ class ImportXlsx extends ModeleImports
if ($key <= $maxfields) {
// Set $newval with value to insert and set $listvalues with sql request part for insert
$newval = '';
- if ($arrayrecord[($key - 1)]['type'] > 0) $newval = $arrayrecord[($key - 1)]['val']; // If type of field into input file is not empty string (so defined into input file), we get value
+ if ($arrayrecord[($key)]['type'] > 0) $newval = $arrayrecord[($key)]['val']; // If type of field into input file is not empty string (so defined into input file), we get value
// Make some tests on $newval
@@ -572,21 +572,21 @@ class ImportXlsx extends ModeleImports
$newval = $this->thirpartyobject->code_client;
//print 'code_client='.$newval;
}
- if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
+ if (empty($newval)) $arrayrecord[($key)]['type'] = -1; // If we get empty value, we will use "null"
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsuppliercodeifauto') {
if (strtolower($newval) == 'auto') {
$newval = $this->thirpartyobject->get_codefournisseur(0, 1);
$newval = $this->thirpartyobject->code_fournisseur;
//print 'code_fournisseur='.$newval;
}
- if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
+ if (empty($newval)) $arrayrecord[($key)]['type'] = -1; // If we get empty value, we will use "null"
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomeraccountancycodeifauto') {
if (strtolower($newval) == 'auto') {
$this->thirpartyobject->get_codecompta('customer');
$newval = $this->thirpartyobject->code_compta;
//print 'code_compta='.$newval;
}
- if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
+ if (empty($newval)) $arrayrecord[($key)]['type'] = -1; // If we get empty value, we will use "null"
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsupplieraccountancycodeifauto') {
if (strtolower($newval) == 'auto') {
$this->thirpartyobject->get_codecompta('supplier');
@@ -594,7 +594,7 @@ class ImportXlsx extends ModeleImports
if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
//print 'code_compta_fournisseur='.$newval;
}
- if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
+ if (empty($newval)) $arrayrecord[($key)]['type'] = -1; // If we get empty value, we will use "null"
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getrefifauto') {
$defaultref = '';
// TODO provide the $modTask (module of generation of ref) as parameter of import_insert function
@@ -624,7 +624,7 @@ class ImportXlsx extends ModeleImports
$errorforthistable++;
$error++;
} else {
- $newval = $arrayrecord[($key - 1)]['val']; //We get new value computed.
+ $newval = $arrayrecord[($key)]['val']; //We get new value computed.
}
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') {
$newval = price2num($newval);
@@ -695,8 +695,8 @@ class ImportXlsx extends ModeleImports
$listfields[] = $fieldname;
// Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert
- if (empty($newval) && $arrayrecord[($key - 1)]['type'] < 0) $listvalues[] = ($newval == '0' ? $newval : "null");
- elseif (empty($newval) && $arrayrecord[($key - 1)]['type'] == 0) $listvalues[] = "''";
+ if (empty($newval) && $arrayrecord[($key)]['type'] < 0) $listvalues[] = ($newval == '0' ? $newval : "null");
+ elseif (empty($newval) && $arrayrecord[($key)]['type'] == 0) $listvalues[] = "''";
else $listvalues[] = "'" . $this->db->escape($newval) . "'";
}
$i++;
diff --git a/htdocs/core/modules/modAsset.class.php b/htdocs/core/modules/modAsset.class.php
index 505ed444f55..6ee48388234 100644
--- a/htdocs/core/modules/modAsset.class.php
+++ b/htdocs/core/modules/modAsset.class.php
@@ -79,7 +79,7 @@ class modAsset extends DolibarrModules
// Data directories to create when module is enabled.
// Example: this->dirs = array("/asset/temp","/asset/subdir");
- $this->dirs = array();
+ $this->dirs = array("/asset/temp");
// Config pages. Put here list of php page, stored into asset/admin directory, to use to setup module.
$this->config_page_url = array("setup.php@asset");
diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php
index f257c6e3132..8cc0dedec6c 100644
--- a/htdocs/core/modules/modCommande.class.php
+++ b/htdocs/core/modules/modCommande.class.php
@@ -288,7 +288,7 @@ class modCommande extends DolibarrModules
'c.fk_user_valid' => 'ValidatedById',
'c.fk_statut' => 'Status*',
'c.remise_percent' => 'GlobalDiscount',
- 'c.tva' => 'TotalTVA',
+ 'c.total_tva' => 'TotalTVA',
'c.total_ht' => 'TotalHT',
'c.total_ttc' => 'TotalTTC',
'c.note_private' => 'NotePrivate',
diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php
index 27d44160949..b4c1dd13e7d 100644
--- a/htdocs/core/modules/modProduct.class.php
+++ b/htdocs/core/modules/modProduct.class.php
@@ -192,6 +192,7 @@ class modProduct extends DolibarrModules
'p.duration'=>"Duration",
'p.finished' => 'Nature',
'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC",
+ 'p.price_min'=>"MinPriceHT",'p.price_min_ttc'=>"MinPriceTTC",
'p.tva_tx'=>'VATRate',
'p.datec'=>'DateCreation', 'p.tms'=>'DateModification'
);
@@ -216,7 +217,9 @@ class modProduct extends DolibarrModules
'p.customcode'=>'Text',
'p.duration'=>"Text",
'p.finished' => 'Numeric',
- 'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric',
+ 'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric",
+ 'p.price_min'=>"Numeric", 'p.price_min_ttc'=>"Numeric",
+ 'p.tva_tx'=>'Numeric',
'p.datec'=>'Date', 'p.tms'=>'Date'
);
if (!empty($conf->stock->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('e.ref'=>'Text', 'p.tobatch'=>'Numeric', 'p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
@@ -547,7 +550,7 @@ class modProduct extends DolibarrModules
// field order as per structure of table llx_product
$import_sample = array(
- 'p.ref' => "PREF123456",
+ 'p.ref' => "ref:PREF123456",
'p.datec' => dol_print_date(dol_now(), '%Y-%m-%d'),
'p.label' => "Product name in default language",
'p.description' => "Product description in default language",
@@ -687,7 +690,7 @@ class modProduct extends DolibarrModules
);
$this->import_examplevalues_array[$r] = array(
- 'sp.fk_product' => "PRODUCT_REF or id:123456",
+ 'sp.fk_product' => "ref:PRODUCT_REF or id:123456",
'sp.fk_soc' => "My Supplier",
'sp.ref_fourn' => "XYZ-F123456",
'sp.quantity' => "5",
@@ -749,13 +752,13 @@ class modProduct extends DolibarrModules
$this->import_convertvalue_array[$r] = array(
'pr.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product')
);
- $this->import_examplevalues_array[$r] = array('pr.fk_product'=>"PRODUCT_REF or id:123456",
+ $this->import_examplevalues_array[$r] = array('pr.fk_product'=>"ref:PRODUCT_REF or id:123456",
'pr.price_base_type'=>"HT (for excl tax) or TTC (for inc tax)", 'pr.price_level'=>"1",
'pr.price'=>"100", 'pr.price_ttc'=>"110",
'pr.price_min'=>"100", 'pr.price_min_ttc'=>"110",
'pr.tva_tx'=>'20',
'pr.recuperableonly'=>'0',
- 'pr.date_price'=>'2013-04-10');
+ 'pr.date_price'=>'2020-12-31');
}
if (!empty($conf->global->MAIN_MULTILANGS))
diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php
index 25d5f6f3526..1a797b936c3 100644
--- a/htdocs/core/tpl/ajaxrow.tpl.php
+++ b/htdocs/core/tpl/ajaxrow.tpl.php
@@ -28,7 +28,7 @@
// Protection to avoid direct call of template
if (empty($object) || !is_object($object))
{
- print "Error, template page can't be called as URL";
+ print "Error, template page ".basename(__FILE__)." can't be called with no object defined.";
exit;
}
diff --git a/htdocs/don/document.php b/htdocs/don/document.php
index 9ff1fa98ea2..a211f076253 100644
--- a/htdocs/don/document.php
+++ b/htdocs/don/document.php
@@ -78,7 +78,7 @@ $modulepart = 'don';
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
if ($action == 'classin' && $user->rights->don->creer)
{
diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php
index a9b19ede7c3..2b710e87dee 100644
--- a/htdocs/expedition/document.php
+++ b/htdocs/expedition/document.php
@@ -76,7 +76,7 @@ if ($object->fetch($id))
$upload_dir = $conf->expedition->dir_output."/sending/".dol_sanitizeFileName($object->ref);
}
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php
index 1b9326468f4..aaab2072013 100644
--- a/htdocs/fichinter/document.php
+++ b/htdocs/fichinter/document.php
@@ -75,7 +75,7 @@ $modulepart = 'fichinter';
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php
index 9d18f3cfd1a..9794ea3cc11 100644
--- a/htdocs/fourn/card.php
+++ b/htdocs/fourn/card.php
@@ -550,7 +550,7 @@ if ($object->id > 0)
{
$langs->loadLangs(array("supplier_proposal"));
- $sql = "SELECT p.rowid, p.ref, p.date_valid as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total as total_ttc";
+ $sql = "SELECT p.rowid, p.ref, p.date_valid as dc, p.fk_statut, p.total_ht, p.total_tva, p.total_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p ";
$sql .= " WHERE p.fk_soc =".$object->id;
$sql .= " AND p.entity IN (".getEntity('supplier_proposal').")";
diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php
index d5a4455db06..293edb549ea 100644
--- a/htdocs/fourn/commande/document.php
+++ b/htdocs/fourn/commande/document.php
@@ -78,7 +78,7 @@ $object->fetch_thirdparty();
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php
index 36f5a45b25e..4b2b45c7226 100644
--- a/htdocs/fourn/facture/document.php
+++ b/htdocs/fourn/facture/document.php
@@ -74,7 +74,7 @@ if ($object->fetch($id, $ref))
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php
index 355b84796f2..5dea09eaf09 100644
--- a/htdocs/fourn/paiement/card.php
+++ b/htdocs/fourn/paiement/card.php
@@ -39,11 +39,22 @@ $action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$object = new PaiementFourn($db);
+// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+$hookmanager->initHooks(array('supplierpaymentcard', 'globalcard'));
+
+// Load object
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
+
+$result = restrictedArea($user, $object->element, $object->id, 'paiementfourn', '');
+
+// Security check
+if ($user->socid) $socid = $user->socid;
+// Now check also permission on thirdparty of invoices of payments. Thirdparty were loaded by the fetch_object before based on first invoice.
+// It should be enough because all payments are done on invoices of the same thirdparty.
+if ($socid && $socid != $object->thirdparty->id) {
+ accessforbidden();
+}
-// PDF
-$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
-$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
-$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
/*
* Actions
@@ -177,41 +188,46 @@ if ($result > 0)
print '';
/*print '';
- print ''.$langs->trans('Ref').' ';
+ print ' '.$langs->trans('Ref').' ';
print $form->showrefnav($object,'id','',1,'rowid','ref');
print ' ';*/
// Date of payment
- print ''.$form->editfieldkey("Date", 'datep', $object->date, $object, $object->statut == 0 && $user->rights->fournisseur->facture->creer).' ';
+ print ' '.$form->editfieldkey("Date", 'datep', $object->date, $object, $object->statut == 0 && $user->rights->fournisseur->facture->creer).' ';
+ print '';
print $form->editfieldval("Date", 'datep', $object->date, $object, $object->statut == 0 && $user->rights->fournisseur->facture->creer, 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded'));
print ' ';
// Payment mode
$labeltype = $langs->trans("PaymentType".$object->type_code) != ("PaymentType".$object->type_code) ? $langs->trans("PaymentType".$object->type_code) : $object->type_label;
- print ''.$langs->trans('PaymentMode').' '.$labeltype;
+ print ' '.$langs->trans('PaymentMode').' ';
+ print ''.$labeltype;
print $object->num_payment ? ' - '.$object->num_payment : '';
print ' ';
// Payment numero
/* TODO Add field num_payment into payment table and save it
- print ''.$form->editfieldkey("Numero",'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).' ';
+ print ' '.$form->editfieldkey("Numero",'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).' ';
+ print '';
print $form->editfieldval("Numero",'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('PaymentNumberUpdateSucceeded'));
print ' ';
*/
// Amount
- print ''.$langs->trans('Amount').' '.price($object->amount, '', $langs, 0, 0, -1, $conf->currency).' ';
+ print ''.$langs->trans('Amount').' ';
+ print ''.price($object->amount, '', $langs, 0, 0, -1, $conf->currency).' ';
if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{
- print ''.$langs->trans('Status').' '.$object->getLibStatut(4).' ';
+ print ''.$langs->trans('Status').' ';
+ print ''.$object->getLibStatut(4).' ';
}
$allow_delete = 1;
// Bank account
if (!empty($conf->banque->enabled))
{
- if ($object->bank_account)
+ if ($object->fk_account)
{
$bankline = new AccountLine($db);
$bankline->fetch($object->bank_line);
@@ -222,8 +238,8 @@ if ($result > 0)
}
print '';
- print ''.$langs->trans('BankAccount').' ';
- print '';
+ print ' '.$langs->trans('BankAccount').' ';
+ print '';
$accountstatic = new Account($db);
$accountstatic->fetch($bankline->fk_account);
print $accountstatic->getNomUrl(1);
@@ -231,8 +247,8 @@ if ($result > 0)
print ' ';
print '';
- print ''.$langs->trans('BankTransactionLine').' ';
- print '';
+ print ' '.$langs->trans('BankTransactionLine').' ';
+ print '';
print $bankline->getNomUrl(1, 0, 'showconciliated');
print ' ';
print ' ';
@@ -240,7 +256,8 @@ if ($result > 0)
}
// Note
- print ''.$form->editfieldkey("Note", 'note', $object->note, $object, $user->rights->fournisseur->facture->creer).' ';
+ print ' '.$form->editfieldkey("Comments", 'note', $object->note, $object, $user->rights->fournisseur->facture->creer).' ';
+ print '';
print $form->editfieldval("Note", 'note', $object->note, $object, $user->rights->fournisseur->facture->creer, 'textarea');
print ' ';
diff --git a/htdocs/fourn/paiement/info.php b/htdocs/fourn/paiement/info.php
index 97ac2343c23..9ff0a86931e 100644
--- a/htdocs/fourn/paiement/info.php
+++ b/htdocs/fourn/paiement/info.php
@@ -33,8 +33,26 @@ $langs->loadLangs(array("bills", "suppliers", "companies"));
$id = GETPOST('id', 'int');
$object = new PaiementFourn($db);
-$object->fetch($id);
-$object->info($id);
+
+// Load object
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
+
+$result = restrictedArea($user, $object->element, $object->id, 'paiementfourn', '');
+
+// Security check
+if ($user->socid) $socid = $user->socid;
+// Now check also permission on thirdparty of invoices of payments. Thirdparty were loaded by the fetch_object before based on first invoice.
+// It should be enough because all payments are done on invoices of the same thirdparty.
+if ($socid && $socid != $object->thirdparty->id) {
+ accessforbidden();
+}
+
+
+/*
+ * Actions
+ */
+
+// None
/*
@@ -43,10 +61,14 @@ $object->info($id);
llxHeader();
+$object->info($id);
+
$head = payment_supplier_prepare_head($object);
print dol_get_fiche_head($head, 'info', $langs->trans("SupplierPayment"), 0, 'payment');
+$linkback = ''.$langs->trans("BackToList").' ';
+
dol_banner_tab($object, 'id', $linkback, -1, 'rowid', 'ref');
print dol_get_fiche_end();
diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php
index 3fca286eff0..1bf8984a6ee 100644
--- a/htdocs/fourn/paiement/list.php
+++ b/htdocs/fourn/paiement/list.php
@@ -178,7 +178,7 @@ if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
-$sql .= ' GROUP BY p.rowid, p.datep, p.amount, p.num_paiement, s.rowid, s.nom, c.code, c.libelle, ba.rowid, ba.label';
+$sql .= ' GROUP BY p.rowid, p.ref, p.datep, p.amount, p.num_paiement, s.rowid, s.nom, s.email, c.code, c.libelle, ba.rowid, ba.label';
if (!$user->rights->societe->client->voir) $sql .= ', sc.fk_soc, sc.fk_user';
$sql .= $db->order($sortfield, $sortorder);
diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php
index f366bb50c85..3bb48d1de15 100644
--- a/htdocs/holiday/document.php
+++ b/htdocs/holiday/document.php
@@ -72,7 +72,7 @@ $modulepart = 'holiday';
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/install/mysql/data/llx_c_chargesociales.sql b/htdocs/install/mysql/data/llx_c_chargesociales.sql
index 324223b274d..b728d9c6414 100644
--- a/htdocs/install/mysql/data/llx_c_chargesociales.sql
+++ b/htdocs/install/mysql/data/llx_c_chargesociales.sql
@@ -33,19 +33,19 @@
--
-- France
--
-insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 1, 'Allocations familiales', 1,1,'TAXFAM' ,'1');
-insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 2, 'CSG Deductible', 1,1,'TAXCSGD' ,'1');
-insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 3, 'CSG/CRDS NON Deductible',0,1,'TAXCSGND' ,'1');
-insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 10, 'Taxe apprentissage', 0,1,'TAXAPP' ,'1');
-insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 11, 'Taxe professionnelle', 0,1,'TAXPRO' ,'1');
-insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 12, 'Cotisation fonciere des entreprises', 0,1,'TAXCFE' ,'1');
-insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 13, 'Cotisation sur la valeur ajoutee des entreprises', 0,1,'TAXCVAE' ,'1');
-insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 20, 'Impots locaux/fonciers', 0,1,'TAXFON' ,'1');
-insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 25, 'Impots revenus', 0,1,'TAXREV' ,'1');
-insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 30, 'Assurance Sante', 0,1,'TAXSECU' ,'1');
-insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 40, 'Mutuelle', 0,1,'TAXMUT' ,'1');
-insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 50, 'Assurance vieillesse', 0,1,'TAXRET' ,'1');
-insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 60, 'Assurance Chomage', 0,1,'TAXCHOM' ,'1');
+insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 1, 'Securite sociale (URSSAF / MSA)', 1, 1, 'TAXSECU', '1');
+insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 2, 'Securite sociale des indépendants (URSSAF)', 1, 1, 'TAXSSI', '1');
+insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 10, 'Taxe apprentissage', 1, 1, 'TAXAPP', '1');
+insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 11, 'Formation professionnelle continue', 1, 1, 'TAXFPC', '1');
+insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 12, 'Cotisation fonciere des entreprises (CFE)', 1, 1, 'TAXCFE', '1');
+insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 13, 'Cotisation sur la valeur ajoutee des entreprises (CVAE)', 1, 1, 'TAXCVAE', '1');
+insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 20, 'Taxe fonciere', 1, 1, 'TAXFON', '1');
+insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 25, 'Prelevement à la source (PAS)', 0, 1, 'TAXPAS', '1');
+insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 30, 'Prevoyance', 1, 1,'TAXPREV', '1');
+insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 40, 'Mutuelle', 1, 1,'TAXMUT', '1');
+insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 50, 'Retraite', 1, 1,'TAXRET', '1');
+insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 60, 'Taxe sur vehicule societe (TVS)', 0, 1, 'TAXTVS', '1');
+insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values ( 70, 'impôts sur les sociétés (IS)', 0, 1, 'TAXIS', '1');
--
-- Belgique
diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
index e4dfc6ad381..fce36bed9d8 100644
--- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
+++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
@@ -30,6 +30,9 @@
-- Missing in v13 or lower
+ALTER TABLE llx_asset CHANGE COLUMN amount amount_ht double(24,8) DEFAULT NULL;
+ALTER TABLE llx_asset ADD COLUMN amount_vat double(24,8) DEFAULT NULL;
+
ALTER TABLE llx_supplier_proposal_extrafields ADD INDEX idx_supplier_proposal_extrafields (fk_object);
ALTER TABLE llx_supplier_proposaldet_extrafields ADD INDEX idx_supplier_proposaldet_extrafields (fk_object);
@@ -170,6 +173,12 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private,
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationMassEmailAttendes', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendes)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOragnisationEventBulkMailToAttendes)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationMassEmailSpeakers', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__ __THIRDPARTY_NAME__, __(ThisIsContentOfYourOragnisationEventBulkMailToSpeakers)__ __(Sincerely)__ __USER_SIGNATURE__', null, '1', null);
+-- Code enhanced - Standardize field name
+ALTER TABLE llx_commande CHANGE COLUMN tva total_tva double(24,8) default 0;
+ALTER TABLE llx_supplier_proposal CHANGE COLUMN tva total_tva double(24,8) default 0;
+ALTER TABLE llx_supplier_proposal CHANGE COLUMN total total_ttc double(24,8) default 0;
+ALTER TABLE llx_propal CHANGE COLUMN tva total_tva double(24,8) default 0;
+
create table llx_salary
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql
index add836ce5d5..e3a075933c2 100644
--- a/htdocs/install/mysql/tables/llx_commande.sql
+++ b/htdocs/install/mysql/tables/llx_commande.sql
@@ -47,7 +47,7 @@ create table llx_commande
remise_percent real default 0,
remise_absolue real default 0,
remise real default 0,
- tva double(24,8) default 0,
+ total_tva double(24,8) default 0,
localtax1 double(24,8) default 0, -- total localtax1
localtax2 double(24,8) default 0, -- total localtax2
total_ht double(24,8) default 0,
diff --git a/htdocs/install/mysql/tables/llx_propal.sql b/htdocs/install/mysql/tables/llx_propal.sql
index 6e3e38dffd6..0a348c6aa6c 100644
--- a/htdocs/install/mysql/tables/llx_propal.sql
+++ b/htdocs/install/mysql/tables/llx_propal.sql
@@ -48,7 +48,7 @@ create table llx_propal
remise_absolue real DEFAULT 0, -- remise globale absolue (obsolete)
remise real DEFAULT 0, -- remise calculee (obsolete)
total_ht double(24,8) DEFAULT 0, -- montant total ht apres remise globale
- tva double(24,8) DEFAULT 0, -- montant total tva apres remise globale
+ total_tva double(24,8) DEFAULT 0, -- montant total tva apres remise globale
localtax1 double(24,8) DEFAULT 0, -- amount total localtax1
localtax2 double(24,8) DEFAULT 0, -- amount total localtax2
total double(24,8) DEFAULT 0, -- montant total ttc apres remise globale
@@ -76,9 +76,9 @@ create table llx_propal
fk_delivery_address integer, -- delivery address (deprecated)
fk_multicurrency integer,
- multicurrency_code varchar(255),
+ multicurrency_code varchar(255),
multicurrency_tx double(24,8) DEFAULT 1,
- multicurrency_total_ht double(24,8) DEFAULT 0,
+ multicurrency_total_ht double(24,8) DEFAULT 0,
multicurrency_total_tva double(24,8) DEFAULT 0,
multicurrency_total_ttc double(24,8) DEFAULT 0
)ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_supplier_proposal.sql b/htdocs/install/mysql/tables/llx_supplier_proposal.sql
index e63c4ff64c7..cf64d76d7d1 100644
--- a/htdocs/install/mysql/tables/llx_supplier_proposal.sql
+++ b/htdocs/install/mysql/tables/llx_supplier_proposal.sql
@@ -37,10 +37,10 @@ CREATE TABLE llx_supplier_proposal (
remise_absolue double DEFAULT 0,
remise double DEFAULT 0,
total_ht double(24,8) DEFAULT 0,
- tva double(24,8) DEFAULT 0,
+ total_tva double(24,8) DEFAULT 0,
localtax1 double(24,8) DEFAULT 0,
localtax2 double(24,8) DEFAULT 0,
- total double(24,8) DEFAULT 0,
+ total_ttc double(24,8) DEFAULT 0,
fk_account integer DEFAULT NULL,
fk_currency varchar(3) DEFAULT NULL,
fk_cond_reglement integer DEFAULT NULL,
diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang
index 33e0c01aad6..d16188d40d4 100644
--- a/htdocs/langs/en_US/agenda.lang
+++ b/htdocs/langs/en_US/agenda.lang
@@ -4,7 +4,7 @@ Actions=Events
Agenda=Agenda
TMenuAgenda=Agenda
Agendas=Agendas
-LocalAgenda=Internal calendar
+LocalAgenda=Default calendar
ActionsOwnedBy=Event owned by
ActionsOwnedByShort=Owner
AffectedTo=Assigned to
@@ -20,7 +20,7 @@ MenuToDoActions=All incomplete events
MenuDoneActions=All terminated events
MenuToDoMyActions=My incomplete events
MenuDoneMyActions=My terminated events
-ListOfEvents=List of events (internal calendar)
+ListOfEvents=List of events (default calendar)
ActionsAskedBy=Events reported by
ActionsToDoBy=Events assigned to
ActionsDoneBy=Events done by
@@ -131,7 +131,7 @@ AgendaUrlOptions4=logint=%s to restrict output to actions assigned to use
AgendaUrlOptionsProject=project=__PROJECT_ID__ to restrict output to actions linked to project __PROJECT_ID__ .
AgendaUrlOptionsNotAutoEvent=notactiontype=systemauto to exclude automatic events.
AgendaUrlOptionsIncludeHolidays=includeholidays=1 to include events of holidays.
-AgendaShowBirthdayEvents=Show birthdays of contacts
+AgendaShowBirthdayEvents=Birthdays of contacts
AgendaHideBirthdayEvents=Hide birthdays of contacts
Busy=Busy
ExportDataset_event1=List of agenda events
diff --git a/htdocs/langs/en_US/assets.lang b/htdocs/langs/en_US/assets.lang
index ef04723c6c2..afafc98503f 100644
--- a/htdocs/langs/en_US/assets.lang
+++ b/htdocs/langs/en_US/assets.lang
@@ -61,5 +61,7 @@ MenuListTypeAssets = List
#
# Module
#
+Asset=Asset
NewAssetType=New asset type
NewAsset=New asset
+ConfirmDeleteAsset=Are you sure you want to delete this asset ?
diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang
index 10c536e0d48..2181b48ecb4 100644
--- a/htdocs/langs/en_US/commercial.lang
+++ b/htdocs/langs/en_US/commercial.lang
@@ -64,10 +64,10 @@ ActionAC_SHIP=Send shipping by mail
ActionAC_SUP_ORD=Send purchase order by mail
ActionAC_SUP_INV=Send vendor invoice by mail
ActionAC_OTH=Other
-ActionAC_OTH_AUTO=Automatically inserted events
+ActionAC_OTH_AUTO=Other auto
ActionAC_MANUAL=Manually inserted events
ActionAC_AUTO=Automatically inserted events
-ActionAC_OTH_AUTOShort=Auto
+ActionAC_OTH_AUTOShort=Other
Stats=Sales statistics
StatusProsp=Prospect status
DraftPropals=Draft commercial proposals
diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang
index 8a0475758e5..247663135db 100644
--- a/htdocs/langs/en_US/eventorganization.lang
+++ b/htdocs/langs/en_US/eventorganization.lang
@@ -18,7 +18,7 @@
#
ModuleEventOrganizationName = Event Organization
-EventOrganizationDescription = Event Organization
+EventOrganizationDescription = Event Organization through Module Project
EventOrganizationDescriptionLong= Manage Event organization for conference, attendees, speaker, and attendees, with public subcription page
#
@@ -42,7 +42,7 @@ EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES = Template of email of massaction
# Object
#
EventOrganizationConfOrBooth= Conference Or Booth
-
+ManageOrganizeEvent = Manage event organisation
#
# Template Mail
diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang
index 3fbcbb0dca7..33a0fafb5dc 100644
--- a/htdocs/langs/en_US/projects.lang
+++ b/htdocs/langs/en_US/projects.lang
@@ -269,5 +269,6 @@ OneLinePerPeriod=One line per period
RefTaskParent=Ref. Parent Task
ProfitIsCalculatedWith=Profit is calculated using
AddPersonToTask=Add also to tasks
+UsageOrganizeEvent=Usage: Event Organization
PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE=Classify project as closed when all its tasks are completed (100%% progress)
PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE_help=Note: existing projects with all tasks at 100 %% progress won't be affected: you will have to close them manually. This option only affects open projects.
diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang
index 072fd057dbf..7ecd5800861 100644
--- a/htdocs/langs/fr_FR/agenda.lang
+++ b/htdocs/langs/fr_FR/agenda.lang
@@ -130,7 +130,7 @@ AgendaUrlOptions4=logint=%s pour limiter l'export aux actions assignées
AgendaUrlOptionsProject=project=__PROJECT_ID__ pour restreindre aux événements associés au projet __PROJECT_ID__ .
AgendaUrlOptionsNotAutoEvent=notactiontype=systemauto pour exclure les événements automatiques.
AgendaUrlOptionsIncludeHolidays=includeholidays=1 pour inclure les événements de type congé.
-AgendaShowBirthdayEvents=Afficher les anniversaires de contacts
+AgendaShowBirthdayEvents=Anniversaires de contacts
AgendaHideBirthdayEvents=Masquer les anniversaires de contacts
Busy=Occupé
ExportDataset_event1=Liste des événements de l'agenda
diff --git a/htdocs/langs/fr_FR/commercial.lang b/htdocs/langs/fr_FR/commercial.lang
index 9b5721326d1..badec05e8c2 100644
--- a/htdocs/langs/fr_FR/commercial.lang
+++ b/htdocs/langs/fr_FR/commercial.lang
@@ -64,10 +64,10 @@ ActionAC_SHIP=Envoi bon d'expédition par email
ActionAC_SUP_ORD=Envoi commande fournisseur par email
ActionAC_SUP_INV=Envoi facture fournisseur par email
ActionAC_OTH=Autre
-ActionAC_OTH_AUTO=Évènements insérés automatiquement
+ActionAC_OTH_AUTO=Autre auto
ActionAC_MANUAL=Événements insérés manuellement
ActionAC_AUTO=Événements insérés automatiquement
-ActionAC_OTH_AUTOShort=Auto
+ActionAC_OTH_AUTOShort=Autre
Stats=Statistiques de vente
StatusProsp=Status prospection
DraftPropals=Propositions brouillons
diff --git a/htdocs/loan/document.php b/htdocs/loan/document.php
index 91bfaf1f921..a7811dfa04a 100644
--- a/htdocs/loan/document.php
+++ b/htdocs/loan/document.php
@@ -68,7 +68,7 @@ $modulepart = 'loan';
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index c91f4802974..15dfc85c8d2 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -185,9 +185,12 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type)
// Check consistency of NOREQUIREXXX DEFINES
-if ((defined('NOREQUIREDB') || defined('NOREQUIRETRAN')) && !defined('NOREQUIREMENU'))
-{
- print 'If define NOREQUIREDB or NOREQUIRETRAN are set, you must also set NOREQUIREMENU or not set them';
+if ((defined('NOREQUIREDB') || defined('NOREQUIRETRAN')) && !defined('NOREQUIREMENU')) {
+ print 'If define NOREQUIREDB or NOREQUIRETRAN are set, you must also set NOREQUIREMENU or not set them.';
+ exit;
+}
+if (defined('NOREQUIREUSER') && !defined('NOREQUIREMENU')) {
+ print 'If define NOREQUIREUSER is set, you must also set NOREQUIREMENU or not set it.';
exit;
}
@@ -595,7 +598,7 @@ if (!defined('NOLOGIN'))
if ($test && GETPOST("username", "alpha", 2) && !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) && !isset($_SESSION['dol_bypass_antispam']))
{
$sessionkey = 'dol_antispam_value';
- $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code'])));
+ $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) === strtolower(GETPOST('code', 'none'))));
// Check code
if (!$ok)
@@ -1007,8 +1010,6 @@ if ((!empty($conf->browser->layout) && $conf->browser->layout == 'phone')
{
$conf->dol_optimize_smallscreen = 1;
}
-// If we force to use jmobile, then we reenable javascript
-if (!empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax = 1;
// Replace themes bugged with jmobile with eldy
if (!empty($conf->dol_use_jmobile) && in_array($conf->theme, array('bureau2crea', 'cameleo', 'amarok')))
{
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index e7da913f39c..e07e7757751 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -772,9 +772,17 @@ class MyObject extends CommonObject
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
- $linkstart = '';
- $linkend = ' ';
+ if ($option == 'nolink') {
+ $linkend = '';
+ } else {
+ $linkend = '';
+ }
$result .= $linkstart;
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index dc4426f7df9..0a5e23cb07a 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -117,9 +117,9 @@ $upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object-
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
-//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
+//$result = restrictedArea($user, $object->element, $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
-//if (!$permissiontoread) accessforbidden();
+//if (empty($permissiontoread)) accessforbidden();
/*
diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php
index 1cd3de2ebd9..f1424906dd6 100644
--- a/htdocs/modulebuilder/template/myobject_document.php
+++ b/htdocs/modulebuilder/template/myobject_document.php
@@ -121,7 +121,7 @@ $permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the incl
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/mrp/mo_document.php b/htdocs/mrp/mo_document.php
index 01131b9ffa2..d3040918aae 100644
--- a/htdocs/mrp/mo_document.php
+++ b/htdocs/mrp/mo_document.php
@@ -80,7 +80,7 @@ $result = restrictedArea($user, 'mrp', $object->id, 'mrp_mo', '', 'fk_soc', 'row
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/product/document.php b/htdocs/product/document.php
index f8f5322f2f8..1de27318f84 100644
--- a/htdocs/product/document.php
+++ b/htdocs/product/document.php
@@ -115,7 +115,7 @@ if (empty($reshook))
}
// Action submit/delete file/link
- include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
}
if ($action == 'filemerge')
diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php
index 3e7c23a6e92..90df912e69d 100644
--- a/htdocs/product/stock/class/productlot.class.php
+++ b/htdocs/product/stock/class/productlot.class.php
@@ -568,15 +568,13 @@ class Productlot extends CommonObject
$result = '';
- $label = ''.$langs->trans("Batch").' ';
+ $label = img_picto('', $this->picto).' '.$langs->trans("Batch").' ';
$label .= '';
$label .= '
'.$langs->trans('Batch').': '.$this->batch;
- if ($this->eatby)
- {
+ if ($this->eatby && empty($conf->global->PRODUCT_DISABLE_EATBY)) {
$label .= '
'.$langs->trans('EatByDate').': '.dol_print_date($this->eatby, 'day');
}
- if ($this->sellby)
- {
+ if ($this->sellby && empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
$label .= '
'.$langs->trans('SellByDate').': '.dol_print_date($this->sellby, 'day');
}
@@ -602,9 +600,17 @@ class Productlot extends CommonObject
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
- $linkstart = '
';
- $linkend = ' ';
+ if ($option == 'nolink') {
+ $linkend = '';
+ } else {
+ $linkend = '';
+ }
$result .= $linkstart;
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php
index 1c93d1ee943..8a4d81419c4 100644
--- a/htdocs/product/stock/index.php
+++ b/htdocs/product/stock/index.php
@@ -28,6 +28,7 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
+require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
$hookmanager = new HookManager($db);
@@ -170,17 +171,19 @@ if ($resql)
if (!empty($conf->productbatch->enabled))
{
print '
'.$langs->trans("Batch").' ';
- if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
+ /*if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
print '
'.$langs->trans("SellByDate").' ';
}
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
print '
'.$langs->trans("EatByDate").' ';
- }
+ }*/
}
print '
'.$langs->trans("Warehouse").' ';
print '
'.$langs->trans("FullList").' ';
print "\n";
+ $tmplotstatic = new Productlot($db);
+
$i = 0;
while ($i < min($num, $max))
{
@@ -198,20 +201,25 @@ if ($resql)
$warehouse->label = $objp->warehouse_label;
$warehouse->lieu = $objp->lieu;
+ $tmplotstatic->batch = $objp->batch;
+ $tmplotstatic->sellby = $objp->sellby;
+ $tmplotstatic->eatby = $objp->eatby;
+
print '
';
print ''.dol_print_date($db->jdate($objp->datem), 'dayhour').' ';
print '';
print $producttmp->getNomUrl(1);
print " \n";
- if (!empty($conf->productbatch->enabled))
- {
- print ''.$objp->batch.' ';
- if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
+ if (!empty($conf->productbatch->enabled)) {
+ print '';
+ print $tmplotstatic->getNomUrl(0, 'nolink');
+ print ' ';
+ /*if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
print ''.dol_print_date($db->jdate($objp->sellby), 'day').' ';
}
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
print ''.dol_print_date($db->jdate($objp->eatby), 'day').' ';
- }
+ }*/
}
print '';
print $warehouse->getNomUrl(1);
diff --git a/htdocs/product/stock/productlot_document.php b/htdocs/product/stock/productlot_document.php
index 535486f8c62..c9b98a1ffe4 100644
--- a/htdocs/product/stock/productlot_document.php
+++ b/htdocs/product/stock/productlot_document.php
@@ -94,7 +94,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
// Action submit/delete file/link
- include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
}
$permtoedit = $user->rights->produit->creer;
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php
index 364cb30633a..0462f9d3391 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -35,7 +35,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
// Load translation files required by the page
-$langs->loadLangs(array('projects', 'companies'));
+$langsLoad=array('projects', 'companies');
+if (!empty($conf->eventorganization->enabled)) {
+ $langsLoad[]='eventorganization';
+}
+
+$langs->loadLangs($langsLoad);
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
@@ -569,10 +574,14 @@ if ($action == 'create' && $user->rights->projet->creer)
print ''.$form->textwithpicto($langs->trans("BillTime"), $htmltext).' ';
print ' ';
}
- /*
- print ' ';
- $htmltext = $langs->trans("OrganizeEvent");
- print $form->textwithpicto($langs->trans("OrganizeEvent"), $htmltext);*/
+
+ if (!empty($conf->eventorganization->enabled))
+ {
+ print ' ';
+ $htmltext = $langs->trans("EventOrganizationDescriptionLong");
+ print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
+ }
+
print ' ';
print ' ';
@@ -855,6 +864,12 @@ if ($action == 'create' && $user->rights->projet->creer)
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '
';
}
+ if (!empty($conf->eventorganization->enabled))
+ {
+ print '
';
+ $htmltext = $langs->trans("EventOrganizationDescriptionLong");
+ print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
+ }
print '';
// Thirdparty
@@ -1020,6 +1035,13 @@ if ($action == 'create' && $user->rights->projet->creer)
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '
';
}
+
+ if (!empty($conf->eventorganization->enabled))
+ {
+ print '
usage_organize_event ? ' checked="checked"' : '')).'"> ';
+ $htmltext = $langs->trans("EventOrganizationDescriptionLong");
+ print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
+ }
print '';
// Visibility
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index c942b68cfe2..ff4be5e8d77 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -200,7 +200,7 @@ class Project extends CommonObject
'usage_bill_time' =>array('type'=>'integer', 'label'=>'UsageBillTimeShort', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
'usage_opportunity' =>array('type'=>'integer', 'label'=>'UsageOpportunity', 'enabled'=>1, 'visible'=>-1, 'position'=>135),
'usage_task' =>array('type'=>'integer', 'label'=>'UsageTasks', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
- 'usage_organize_event' =>array('type'=>'integer', 'label'=>'Usage organize event', 'enabled'=>1, 'visible'=>-1, 'position'=>145),
+ 'usage_organize_event' =>array('type'=>'integer', 'label'=>'UsageOrganizeEvent', 'enabled'=>1, 'visible'=>-1, 'position'=>145),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreationShort', 'enabled'=>1, 'visible'=>-2, 'position'=>200),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModificationShort', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>205),
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserCreation', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>210),
@@ -232,6 +232,8 @@ class Project extends CommonObject
*/
public function __construct($db)
{
+ global $conf;
+
$this->db = $db;
$this->statuts_short = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed');
@@ -248,12 +250,12 @@ class Project extends CommonObject
$this->fields['usage_opportunity']['enabled'] = 0;
}
- if (empty($conf->global->PROJECT_HIDE_TASKS)) {
+ if (!empty($conf->global->PROJECT_HIDE_TASKS)) {
$this->fields['usage_bill_time']['visible'] = 0;
$this->fields['usage_task']['visible'] = 0;
}
- if (empty($conf->global->PROJECT_ORGANIZE_EVENTS)) {
+ if (empty($conf->eventorganization->enabled)) {
$this->fields['usage_organize_event']['visible'] = 0;
}
}
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index a2e670906ca..39a572e6510 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -390,7 +390,7 @@ class Task extends CommonObject
}
}
- if (!$error && $conf->global->PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE) {
+ if (!$error && !empty($conf->global->PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE)) {
// Close the parent project if it is open (validated) and its tasks are 100% completed
$project = new Project($this->db);
if ($project->fetch($this->fk_project) > 0 && $project->statut == Project::STATUS_VALIDATED) {
diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php
index bed7f6a43e1..5557740704d 100644
--- a/htdocs/projet/document.php
+++ b/htdocs/projet/document.php
@@ -76,7 +76,7 @@ if (!$sortfield) $sortfield = "name";
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php
index ad8418dfc0e..c51713d1cce 100644
--- a/htdocs/projet/list.php
+++ b/htdocs/projet/list.php
@@ -92,6 +92,7 @@ $search_sale = GETPOST('search_sale', 'int');
$search_usage_opportunity = GETPOST('search_usage_opportunity', 'int');
$search_usage_task = GETPOST('search_usage_task', 'int');
$search_usage_bill_time = GETPOST('search_usage_bill_time', 'int');
+$search_usage_event_organization = GETPOST('search_usage_event_organization', 'int');
$optioncss = GETPOST('optioncss', 'alpha');
$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
@@ -207,6 +208,7 @@ if (empty($reshook))
$search_usage_opportunity = '';
$search_usage_task = '';
$search_usage_bill_time = '';
+ $search_usage_event_organization = '';
$toselect = '';
$search_array_options = array();
$search_category_array = array();
@@ -300,7 +302,8 @@ if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0] = '0'; /
$distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once.
$sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut as status, p.fk_opp_status, p.public, p.fk_user_creat";
-$sql .= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount, p.usage_opportunity, p.usage_task, p.usage_bill_time";
+$sql .= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount ";
+$sql .= ", p.usage_opportunity, p.usage_task, p.usage_bill_time, p.usage_organize_event";
$sql .= ", s.rowid as socid, s.nom as name, s.email";
$sql .= ", cls.code as opp_status_code";
// Add fields from extrafields
@@ -369,6 +372,7 @@ if ($search_budget_amount != '') $sql .= natural_search('p.budget_amount', $sear
if ($search_usage_opportunity != '' && $search_usage_opportunity >= 0) $sql .= natural_search('p.usage_opportunity', $search_usage_opportunity, 2);
if ($search_usage_task != '' && $search_usage_task >= 0) $sql .= natural_search('p.usage_task', $search_usage_task, 2);
if ($search_usage_bill_time != '' && $search_usage_bill_time >= 0) $sql .= natural_search('p.usage_bill_time', $search_usage_bill_time, 2);
+if ($search_usage_event_organization != '' && $search_usage_event_organization >= 0) $sql .= natural_search('p.usage_organize_event', $search_usage_event_organization, 2);
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
@@ -443,6 +447,9 @@ if ($search_project_user != '') $param .= '&search_project_user='.urlencode($s
if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale);
if ($search_opp_amount != '') $param .= '&search_opp_amount='.urlencode($search_opp_amount);
if ($search_budget_amount != '') $param .= '&search_budget_amount='.urlencode($search_budget_amount);
+if ($search_usage_task != '') $param .= '&search_usage_task='.urlencode($search_usage_task);
+if ($search_usage_bill_time != '') $param .= '&search_usage_opportunity='.urlencode($search_usage_bill_time);
+if ($search_usage_event_organization != '') $param .= '&search_usage_event_organization='.urlencode($search_usage_event_organization);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@@ -650,6 +657,12 @@ if (!empty($arrayfields['p.usage_bill_time']['checked']))
print $form->selectyesno('search_usage_bill_time', $search_usage_bill_time, 1, false, 1);
print '';
}
+if (!empty($arrayfields['p.usage_organize_event']['checked']))
+{
+ print '
';
+ print $form->selectyesno('search_usage_event_organization', $search_usage_event_organization, 1, false, 1);
+ print ' ';
+}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
@@ -703,6 +716,7 @@ if (!empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre(
if (!empty($arrayfields['p.usage_opportunity']['checked'])) print_liste_field_titre($arrayfields['p.usage_opportunity']['label'], $_SERVER["PHP_SELF"], 'p.usage_opportunity', "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['p.usage_task']['checked'])) print_liste_field_titre($arrayfields['p.usage_task']['label'], $_SERVER["PHP_SELF"], 'p.usage_task', "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['p.usage_bill_time']['checked'])) print_liste_field_titre($arrayfields['p.usage_bill_time']['label'], $_SERVER["PHP_SELF"], 'p.usage_bill_time', "", $param, '', $sortfield, $sortorder, 'right ');
+if (!empty($arrayfields['p.usage_organize_event']['checked'])) print_liste_field_titre($arrayfields['p.usage_organize_event']['label'], $_SERVER["PHP_SELF"], 'p.usage_organize_event', "", $param, '', $sortfield, $sortorder, 'right ');
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
@@ -927,6 +941,17 @@ while ($i < min($num, $limit))
print '';
if (!$i) $totalarray['nbfield']++;
}
+ // Event Organization
+ if (!empty($arrayfields['p.usage_organize_event']['checked']))
+ {
+ print '
';
+ if ($obj->usage_event_organization)
+ {
+ print yn($obj->usage_event_organization);
+ }
+ print ' ';
+ if (!$i) $totalarray['nbfield']++;
+ }
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php
index ca273bb36ef..ef4ad0292f3 100644
--- a/htdocs/projet/tasks/document.php
+++ b/htdocs/projet/tasks/document.php
@@ -106,7 +106,7 @@ if ($id > 0 || !empty($ref))
}
}
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/public/cron/cron_run_jobs.php b/htdocs/public/cron/cron_run_jobs_by_url.php
similarity index 100%
rename from htdocs/public/cron/cron_run_jobs.php
rename to htdocs/public/cron/cron_run_jobs_by_url.php
diff --git a/htdocs/public/test/badges.php b/htdocs/public/test/badges.php
index 60652b97dc5..194e9947624 100644
--- a/htdocs/public/test/badges.php
+++ b/htdocs/public/test/badges.php
@@ -1,17 +1,21 @@
diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php
index 95265831670..879f37ed5dc 100644
--- a/htdocs/public/test/test_arrays.php
+++ b/htdocs/public/test/test_arrays.php
@@ -1,6 +1,17 @@
This page is a sample of page using tables. It is designed to make test with
+
+
-
Example 0a : Table with div+div+div containg a select that should be overflowed and truncated => Use this to align text or form
@@ -124,7 +135,6 @@ This page is a sample of page using tables. It is designed to make test with
-
@@ -153,6 +163,7 @@ $(document).ready(function() {
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$productspecimen = new Product($db);
$productspecimen->initAsSpecimen();
+$object = $productspecimen;
$sortfield = 'aaa';
$sortorder = 'ASC';
@@ -176,31 +187,30 @@ $nav .= ' trans('This is a select list for a filter A').': ';
+$moreforfilter .= $langs->trans('This is a select list for a filter A (no combo forced)').': ';
$cate_arbo = array('field1'=>'value1a into the select list A', 'field2'=>'value2a');
-$moreforfilter .= $form->selectarray('search_aaa', $cate_arbo, '', 1); // List without js combo
+$moreforfilter .= $form->selectarray('search_aaa', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 0); // List with no js combo
$moreforfilter .= ' ';
$moreforfilter .= '';
-$moreforfilter .= $langs->trans('This is a select list for a filter B').': ';
+$moreforfilter .= $langs->trans('This is a select list for a filter B (auto combo)').': ';
$cate_arbo = array('field1'=>'value1b into the select list B', 'field2'=>'value2b');
-$moreforfilter .= $form->selectarray('search_bbb', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo
+$moreforfilter .= $form->selectarray('search_bbb', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', -1); // List with js combo auto
$moreforfilter .= '
';
$moreforfilter .= '';
-$moreforfilter .= $langs->trans('This is a select list for a filter C').': ';
+$moreforfilter .= $langs->trans('This is a select list for a filter C (combo forced)').': ';
$cate_arbo = array('field1'=>'value1c into the select list C', 'field2'=>'value2c');
-$moreforfilter .= $form->selectarray('search_ccc', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo
+$moreforfilter .= $form->selectarray('search_ccc', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 1); // List with js combo forced
$moreforfilter .= '
';
$moreforfilter .= '';
-$moreforfilter .= $langs->trans('This is a select list for a filter D').': ';
+$moreforfilter .= $langs->trans('This is a select list for a filter D (combo forced)').': ';
$cate_arbo = array('field1'=>'value1d into the select list D', 'field2'=>'value2d');
-$moreforfilter .= $form->selectarray('search_ddd', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo
+$moreforfilter .= $form->selectarray('search_ddd', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 1); // List with js combo forced
$moreforfilter .= '
';
if (!empty($moreforfilter))
@@ -219,14 +229,14 @@ if (!empty($moreforfilter))
trans('title1'), 0, $_SERVER["PHP_SELF"], 'aaa', '', '', 'align="left"', $sortfield, $sortorder); ?>
-trans('title2'), 0, $_SERVER["PHP_SELF"], 'bbb', '', '', 'align="right"', $sortfield, $sortorder); ?>
-trans('title3'), 0, $_SERVER["PHP_SELF"], 'ccc', '', '', 'align="center"', $sortfield, $sortorder); ?>
+trans('title2'), 0, $_SERVER["PHP_SELF"], 'bbb', '', '', 'align="center"', $sortfield, $sortorder); ?>
+trans('title3'), 0, $_SERVER["PHP_SELF"], 'ccc', '', '', 'align="right"', $sortfield, $sortorder); ?>
-getNomUrl(1); ?> b1 c1
-a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 b2 c2
-a3 b3 c3
+getNomUrl(1); ?> b1 c1
+a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 b2 c2
+a3 b3 c3
@@ -237,8 +247,6 @@ if (!empty($moreforfilter))
@@ -304,13 +311,13 @@ $(document).ready(function(){
diff --git a/htdocs/public/test/test_csrf.php b/htdocs/public/test/test_csrf.php
index 8c242cade64..1c23dc7070a 100644
--- a/htdocs/public/test/test_csrf.php
+++ b/htdocs/public/test/test_csrf.php
@@ -3,14 +3,16 @@
?>
-This is a form to test a CSRF.
+This is a form to test if a CSRF exists into a Dolibarr page.
-Open this form into a Virtual server A.
-Change url to send request to into file to send request to virtual server B.
+- Change url to send request to into this file (server B, hard coded page)
+- Open this form into a virtual server A.
+- Send the request to the virtual server B by clicking submit.
+- Check that Anticsrf protection is triggered.
';
?>
diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php
index bd74ecb0f13..646eeb2abc1 100644
--- a/htdocs/public/test/test_forms.php
+++ b/htdocs/public/test/test_forms.php
@@ -1,7 +1,7 @@
\n";
+print 'PHP_SESSION_DISABLED='.PHP_SESSION_DISABLED."
\n";
+print 'PHP_SESSION_NONE='.PHP_SESSION_NONE."
\n";
+print 'PHP_SESSION_ACTIVE='.PHP_SESSION_ACTIVE."
\n";
+print '
';
+
+print 'session_status='.session_status().' (before main.inc.php)';
print '
';
-print session_status();
require '../../main.inc.php';
-print session_status();
+
+/* No need for this.
+if ($dolibarr_main_prod) {
+ accessforbidden();
+}
+*/
+
+print 'session_status='.session_status().' (after main.inc.php)';
print '
';
//print 'a'.$_SESSION['disablemodules'].'b';
-print 'This page is visible. It means you are not locked.';
+print "\n
This page is visible. It means you are not locked by another page called in same session.";
//session_write_close();
diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php
index 1c81faca1ad..6b035a46643 100644
--- a/htdocs/public/ticket/create_ticket.php
+++ b/htdocs/public/ticket/create_ticket.php
@@ -143,6 +143,17 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('add', 'alpha')) {
$action = '';
}
+ // Check Captcha code if is enabled
+ if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) {
+ $sessionkey = 'dol_antispam_value';
+ $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) === strtolower(GETPOST('code', 'none'))));
+ if (!$ok) {
+ $error++;
+ array_push($object->errors, $langs->trans("ErrorBadValueForCode"));
+ $action = '';
+ }
+ }
+
if (!$error) {
$object->db->begin();
diff --git a/htdocs/recruitment/recruitmentcandidature_document.php b/htdocs/recruitment/recruitmentcandidature_document.php
index 1c801f27fd4..8c29ef9e46c 100644
--- a/htdocs/recruitment/recruitmentcandidature_document.php
+++ b/htdocs/recruitment/recruitmentcandidature_document.php
@@ -92,7 +92,7 @@ $permissiontoadd = $user->rights->recruitment->recruitmentjobposition->write; //
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/recruitment/recruitmentjobposition_document.php b/htdocs/recruitment/recruitmentjobposition_document.php
index 3005b4cc1be..d05e9945eb5 100644
--- a/htdocs/recruitment/recruitmentjobposition_document.php
+++ b/htdocs/recruitment/recruitmentjobposition_document.php
@@ -92,7 +92,7 @@ $permissiontoadd = $user->rights->recruitment->recruitmentjobposition->write; //
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/resource/document.php b/htdocs/resource/document.php
index 0019d6b99ed..00dc42741e1 100644
--- a/htdocs/resource/document.php
+++ b/htdocs/resource/document.php
@@ -72,7 +72,7 @@ $modulepart = 'resource';
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/salaries/document.php b/htdocs/salaries/document.php
index 7bb8f67802e..ddb165dd498 100644
--- a/htdocs/salaries/document.php
+++ b/htdocs/salaries/document.php
@@ -74,7 +74,7 @@ $modulepart = 'salaries';
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index c4d355ab62c..f855a80ef7f 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -984,6 +984,7 @@ class Societe extends CommonObject
$contact->email = $this->email;
$contact->zip = $this->zip;
$contact->town = $this->town;
+ $this->setUpperOrLowerCase();
$contact->phone_pro = $this->phone;
$contactId = $contact->create($user);
diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php
index 1d7ba3d2925..034522a3652 100644
--- a/htdocs/societe/document.php
+++ b/htdocs/societe/document.php
@@ -81,7 +81,7 @@ $hookmanager->initHooks(array('thirdpartydocument', 'globalcard'));
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php
index 405c34734f3..c56fac31a3f 100644
--- a/htdocs/supplier_proposal/class/supplier_proposal.class.php
+++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php
@@ -906,8 +906,8 @@ class SupplierProposal extends CommonObject
$sql .= ", remise";
$sql .= ", remise_percent";
$sql .= ", remise_absolue";
- $sql .= ", tva";
- $sql .= ", total";
+ $sql .= ", total_tva";
+ $sql .= ", total_ttc";
$sql .= ", datec";
$sql .= ", ref";
$sql .= ", fk_user_author";
@@ -1200,7 +1200,7 @@ class SupplierProposal extends CommonObject
global $conf;
$sql = "SELECT p.rowid, p.entity, p.ref, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
- $sql .= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht";
+ $sql .= ", p.total_ttc, p.total_tva, p.localtax1, p.localtax2, p.total_ht";
$sql .= ", p.datec";
$sql .= ", p.date_valid as datev";
$sql .= ", p.date_livraison as delivery_date";
@@ -1239,12 +1239,11 @@ class SupplierProposal extends CommonObject
$this->remise = $obj->remise;
$this->remise_percent = $obj->remise_percent;
$this->remise_absolue = $obj->remise_absolue;
- $this->total = $obj->total; // TODO deprecated
$this->total_ht = $obj->total_ht;
- $this->total_tva = $obj->tva;
+ $this->total_tva = $obj->total_tva;
$this->total_localtax1 = $obj->localtax1;
$this->total_localtax2 = $obj->localtax2;
- $this->total_ttc = $obj->total;
+ $this->total_ttc = $obj->total_ttc;
$this->socid = $obj->fk_soc;
$this->fk_project = $obj->fk_project;
$this->model_pdf = $obj->model_pdf;
@@ -2784,7 +2783,7 @@ class SupplierProposalLine extends CommonObjectLine
// Bit 0: 0 si TVA normal - 1 si TVA NPR
// Bit 1: 0 ligne normale - 1 si ligne de remise fixe
- public $total_ht; // Total HT de la ligne toute quantite et incluant la remise ligne
+ public $total_ht; // Total HT de la ligne toute quantite et incluant la remise ligne
public $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne
public $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne
diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php
index 127b45466e8..09fb48ab1fb 100644
--- a/htdocs/supplier_proposal/document.php
+++ b/htdocs/supplier_proposal/document.php
@@ -69,7 +69,7 @@ if ($object->id > 0)
{
$object->fetch_thirdparty();
$upload_dir = $conf->supplier_proposal->dir_output.'/'.dol_sanitizeFileName($object->ref);
- include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
}
diff --git a/htdocs/supplier_proposal/index.php b/htdocs/supplier_proposal/index.php
index 476c2a14db2..fd3dccce0bb 100644
--- a/htdocs/supplier_proposal/index.php
+++ b/htdocs/supplier_proposal/index.php
@@ -304,7 +304,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
$now = dol_now();
- $sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as supplier_proposalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datec as dp";
+ $sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as supplier_proposalid, p.total_ttc, p.total_tva, p.total_ht, p.ref, p.fk_statut, p.datec as dp";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."supplier_proposal as p";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php
index 9826c2a409d..04bafe19297 100644
--- a/htdocs/supplier_proposal/list.php
+++ b/htdocs/supplier_proposal/list.php
@@ -152,7 +152,7 @@ $arrayfields = array(
'sp.date_valid'=>array('label'=>$langs->trans("Date"), 'checked'=>1),
'sp.date_livraison'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1),
'sp.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
- 'sp.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
+ 'sp.total_tva'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
'sp.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
'sp.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
'sp.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
@@ -253,7 +253,7 @@ if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DI
$sql .= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
$sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
-$sql .= ' sp.rowid, sp.note_private, sp.total_ht, sp.tva as total_vat, sp.total as total_ttc, sp.localtax1, sp.localtax2, sp.ref, sp.fk_statut as status, sp.fk_user_author, sp.date_valid, sp.date_livraison as dp,';
+$sql .= ' sp.rowid, sp.note_private, sp.total_ht, sp.total_tva, sp.total_ttc, sp.localtax1, sp.localtax2, sp.ref, sp.fk_statut as status, sp.fk_user_author, sp.date_valid, sp.date_livraison as dp,';
$sql .= ' sp.fk_multicurrency, sp.multicurrency_code, sp.multicurrency_tx, sp.multicurrency_total_ht, sp.multicurrency_total_tva as multicurrency_total_vat, sp.multicurrency_total_ttc,';
$sql .= ' sp.datec as date_creation, sp.tms as date_update,';
$sql .= " p.rowid as project_id, p.ref as project_ref,";
@@ -299,8 +299,8 @@ if ($search_ref) $sql .= natural_search('sp.ref', $search_ref);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_login) $sql .= natural_search('u.login', $search_login);
if ($search_montant_ht) $sql .= natural_search('sp.total_ht=', $search_montant_ht, 1);
-if ($search_montant_vat != '') $sql .= natural_search("sp.tva", $search_montant_vat, 1);
-if ($search_montant_ttc != '') $sql .= natural_search("sp.total", $search_montant_ttc, 1);
+if ($search_montant_vat != '') $sql .= natural_search("sp.total_tva", $search_montant_vat, 1);
+if ($search_montant_ttc != '') $sql .= natural_search("sp.total_ttc", $search_montant_ttc, 1);
if ($search_multicurrency_code != '') $sql .= ' AND sp.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"';
if ($search_multicurrency_tx != '') $sql .= natural_search('sp.multicurrency_tx', $search_multicurrency_tx, 1);
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('sp.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
@@ -552,7 +552,7 @@ if ($resql)
print '
';
print '';
}
- if (!empty($arrayfields['sp.total_vat']['checked']))
+ if (!empty($arrayfields['sp.total_tva']['checked']))
{
// Amount
print '
';
@@ -653,7 +653,7 @@ if ($resql)
if (!empty($arrayfields['sp.date_valid']['checked'])) print_liste_field_titre($arrayfields['sp.date_valid']['label'], $_SERVER["PHP_SELF"], 'sp.date_valid', '', $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['sp.date_livraison']['checked'])) print_liste_field_titre($arrayfields['sp.date_livraison']['label'], $_SERVER["PHP_SELF"], 'sp.date_livraison', '', $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['sp.total_ht']['checked'])) print_liste_field_titre($arrayfields['sp.total_ht']['label'], $_SERVER["PHP_SELF"], 'sp.total_ht', '', $param, '', $sortfield, $sortorder, 'right ');
- if (!empty($arrayfields['sp.total_vat']['checked'])) print_liste_field_titre($arrayfields['sp.total_vat']['label'], $_SERVER["PHP_SELF"], 'sp.total_vat', '', $param, '', $sortfield, $sortorder, 'right ');
+ if (!empty($arrayfields['sp.total_tva']['checked'])) print_liste_field_titre($arrayfields['sp.total_tva']['label'], $_SERVER["PHP_SELF"], 'sp.total_tva', '', $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['sp.total_ttc']['checked'])) print_liste_field_titre($arrayfields['sp.total_ttc']['label'], $_SERVER["PHP_SELF"], 'sp.total_ttc', '', $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['sp.multicurrency_code']['checked'])) print_liste_field_titre($arrayfields['sp.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'sp.multicurrency_code', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['sp.multicurrency_tx']['checked'])) print_liste_field_titre($arrayfields['sp.multicurrency_tx']['label'], $_SERVER['PHP_SELF'], 'sp.multicurrency_tx', '', $param, '', $sortfield, $sortorder);
@@ -803,12 +803,12 @@ if ($resql)
$totalarray['val']['sp.total_ht'] += $obj->total_ht;
}
// Amount VAT
- if (!empty($arrayfields['sp.total_vat']['checked']))
+ if (!empty($arrayfields['sp.total_tva']['checked']))
{
- print ' '.price($obj->total_vat)." \n";
+ print '
'.price($obj->total_tva)." \n";
if (!$i) $totalarray['nbfield']++;
- if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_vat';
- $totalarray['val']['sp.total_vat'] += $obj->total_vat;
+ if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_tva';
+ $totalarray['val']['sp.total_tva'] += $obj->total_tva;
}
// Amount TTC
if (!empty($arrayfields['sp.total_ttc']['checked']))
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index d39e7a3e1b5..326aac90390 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -621,7 +621,7 @@ textarea.centpercent {
}
.flip {
- transform: scaleX(-1);
+ transform: scaleX(-1) translate(2px, 0);
}
.center {
text-align: center;
@@ -3503,6 +3503,7 @@ table.hidepaginationnext .paginationnext {
}
+
/* Set the color for hover lines */
.oddeven:hover, .evenodd:hover, .impair:hover, .pair:hover
{
@@ -4531,7 +4532,7 @@ div.visible {
display: block;
}
-div.hidden, td.hidden, img.hidden, span.hidden {
+div.hidden, td.hidden, img.hidden, span.hidden, div.showifmore {
display: none;
}
@@ -4632,6 +4633,10 @@ span.websitebuttonsitepreviewdisabled img, a.websitebuttonsitepreviewdisabled im
line-height: 1em;
}
+#divbodywebsite section p {
+ margin: unset;
+}
+
/* ============================================================================== */
diff --git a/htdocs/theme/eldy/main_menu_fa_icons.inc.php b/htdocs/theme/eldy/main_menu_fa_icons.inc.php
index 53a685c096e..156da9be652 100644
--- a/htdocs/theme/eldy/main_menu_fa_icons.inc.php
+++ b/htdocs/theme/eldy/main_menu_fa_icons.inc.php
@@ -203,6 +203,10 @@ div.mainmenu.generic4::before {
font-size: 0.92em;
}
+.menu_titre .em088 {
+ font-size: 0.88em;
+}
+
.menu_titre .em080 {
font-size: 0.80em;
}
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 623ecb2a779..81407987c35 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -4402,7 +4402,7 @@ div.visible {
display: block;
}
-div.hidden, td.hidden, img.hidden, span.hidden {
+div.hidden, td.hidden, img.hidden, span.hidden, div.showifmore {
display: none;
}
@@ -4509,6 +4509,10 @@ span.websitebuttonsitepreviewdisabled img, a.websitebuttonsitepreviewdisabled im
line-height: 1em;
}
+#divbodywebsite section p {
+ margin: unset;
+}
+
/* ============================================================================== */
/* Module agenda */
diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php
index 45ee7aba268..c876e9d33d8 100644
--- a/htdocs/ticket/document.php
+++ b/htdocs/ticket/document.php
@@ -73,7 +73,7 @@ if ($result < 0) {
* Actions
*/
-include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 8f8f8c67ca8..8712bcc4615 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -1402,6 +1402,7 @@ class User extends CommonObject
$this->address = $contact->address;
$this->zip = $contact->zip;
$this->town = $contact->town;
+ $this->setUpperOrLowerCase();
$this->state_id = $contact->state_id;
$this->country_id = $contact->country_id;
$this->employee = 0;
@@ -1474,12 +1475,13 @@ class User extends CommonObject
$this->civility_code = $member->civility_id;
$this->lastname = $member->lastname;
$this->firstname = $member->firstname;
- $this->gender = $member->gender;
+ $this->gender = $member->gender;
$this->email = $member->email;
$this->fk_member = $member->id;
$this->address = $member->address;
$this->zip = $member->zip;
$this->town = $member->town;
+ $this->setUpperOrLowerCase();
$this->state_id = $member->state_id;
$this->country_id = $member->country_id;
$this->socialnetworks = $member->socialnetworks;
@@ -1637,6 +1639,7 @@ class User extends CommonObject
$this->address = empty($this->address) ? '' : $this->address;
$this->zip = empty($this->zip) ? '' : $this->zip;
$this->town = empty($this->town) ? '' : $this->town;
+ $this->setUpperOrLowerCase();
$this->accountancy_code = trim($this->accountancy_code);
$this->color = empty($this->color) ? '' : $this->color;
$this->dateemployment = empty($this->dateemployment) ? '' : $this->dateemployment;
diff --git a/htdocs/user/document.php b/htdocs/user/document.php
index 5440ceeb725..b9f282f17ed 100644
--- a/htdocs/user/document.php
+++ b/htdocs/user/document.php
@@ -106,7 +106,7 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) {
- include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
}
diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index ca038935af9..46dfd49ed0a 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -358,7 +358,7 @@ if ($action == 'seteditinline')
{
dolibarr_set_const($db, 'WEBSITE_EDITINLINE', 1);
setEventMessages($langs->trans("FeatureNotYetAvailable"), null, 'warnings');
- dolibarr_set_const($db, 'WEBSITE_SUBCONTAINERSINLINE', 0); // Force disable of 'Include dynamic content'
+ //dolibarr_set_const($db, 'WEBSITE_SUBCONTAINERSINLINE', 0); // Force disable of 'Include dynamic content'
header("Location: ".$_SERVER["PHP_SELF"].'?website='.GETPOST('website', 'alphanohtml').'&pageid='.GETPOST('pageid', 'int'));
exit;
}
@@ -371,7 +371,7 @@ if ($action == 'unseteditinline')
if ($action == 'setshowsubcontainers')
{
dolibarr_set_const($db, 'WEBSITE_SUBCONTAINERSINLINE', 1);
- dolibarr_set_const($db, 'WEBSITE_EDITINLINE', 0); // Force disable of edit inline
+ //dolibarr_set_const($db, 'WEBSITE_EDITINLINE', 0); // Force disable of edit inline
header("Location: ".$_SERVER["PHP_SELF"].'?website='.GETPOST('website', 'alphanohtml').'&pageid='.GETPOST('pageid', 'int'));
exit;
}
@@ -2743,7 +2743,19 @@ if (!GETPOST('hide_websitemenu'))
print ''."\n";
print '
';
- print '
';
+
+ print '
'; // Button include dynamic contant
+ print $langs->trans("ShowSubcontainers");
+ if (empty($conf->global->WEBSITE_SUBCONTAINERSINLINE))
+ {
+ print '
ref.'&pageid='.$websitepage->id.'&action=setshowsubcontainers&token='.newToken().'">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').' ';
+ }
+ else {
+ print '
ref.'&pageid='.$websitepage->id.'&action=unsetshowsubcontainers&token='.newToken().'">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', false, 0, 0, '', 'nomarginleft').' ';
+ }
+ print '
';
+
+ print '
'; // Button edit inline
print ''."\n";
print ''."\n";
@@ -2812,17 +2824,7 @@ if (!GETPOST('hide_websitemenu'))
}
print '
';
- print '
';
- print $langs->trans("ShowSubcontainers");
- if (empty($conf->global->WEBSITE_SUBCONTAINERSINLINE))
- {
- print '
ref.'&pageid='.$websitepage->id.'&action=setshowsubcontainers&token='.newToken().'">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').' ';
- }
- else {
- print '
ref.'&pageid='.$websitepage->id.'&action=unsetshowsubcontainers&token='.newToken().'">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', false, 0, 0, '', 'nomarginleft').' ';
- }
- /*}*/
- print '
';
+
print '
';
// Set page as homepage
@@ -4275,7 +4277,7 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa
// REPLACEMENT OF LINKS When page called by website editor
$out .= ''."\n";
- $out .= '