Merge branch 'develop' of github.com:Dolibarr/dolibarr into NEW/add_real_payments_on_salaries
This commit is contained in:
commit
939d406ab1
62
ChangeLog
62
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
|
||||
|
||||
@ -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
|
||||
|
||||
BIN
doc/images/dolibarr_screenshot12_1920x1080.jpg
Normal file
BIN
doc/images/dolibarr_screenshot12_1920x1080.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 219 KiB |
@ -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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -326,7 +326,8 @@ print '</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PDF_USE_ALSO_LANGUAGE_CODE").'</td><td>';
|
||||
//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 '<span class="opacitymedium">'.$langs->trans("MultiLangNotEnabled").'</span>';
|
||||
//}
|
||||
|
||||
@ -120,7 +120,7 @@ if (function_exists('curl_init'))
|
||||
print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("UpdateServerOffline").'</b>';
|
||||
}
|
||||
} else {
|
||||
print $langs->trans("LastStableVersion").' : <a href="'.$_SERVER["PHP_SELF"].'?action=getlastversion" class="butAction">'.$langs->trans("Check").'</a>';
|
||||
print $langs->trans("LastStableVersion").' : <a href="'.$_SERVER["PHP_SELF"].'?action=getlastversion" class="butAction smallpaddingimp">'.$langs->trans("Check").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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 '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
function init_myfunc()
|
||||
{
|
||||
jQuery("#myid").removeAttr(\'disabled\');
|
||||
jQuery("#myid").attr(\'disabled\',\'disabled\');
|
||||
}
|
||||
init_myfunc();
|
||||
jQuery("#mybutton").click(function() {
|
||||
init_myfunc();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
// 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 '</table>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="clearboth"></div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
// Buttons for actions
|
||||
if ($action != 'presend' && $action != 'editline') {
|
||||
print '<div class="tabsAction">'."\n";
|
||||
/*
|
||||
* Buttons
|
||||
*/
|
||||
if ($user->socid == 0)
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>'."\n";
|
||||
}
|
||||
|
||||
if ($user->rights->asset->write)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>'."\n";
|
||||
@ -328,13 +297,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
|
||||
}
|
||||
}
|
||||
print '</div>'."\n";
|
||||
}
|
||||
|
||||
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
if ($action != 'presend')
|
||||
@ -343,27 +306,23 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<a name="builddoc"></a>'; // 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 '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
$MAXEVENT = 10;
|
||||
|
||||
$morehtmlright = '<a href="'.dol_buildpath('/asset/asset_info.php', 1).'?id='.$object->id.'">';
|
||||
$morehtmlright .= $langs->trans("SeeAll");
|
||||
$morehtmlright .= '</a>';
|
||||
$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 '</div></div></div>';
|
||||
}
|
||||
|
||||
//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';
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -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 = '<a href="'.DOL_URL_ROOT.'/asset/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref = '';
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';
|
||||
print "</table>\n";
|
||||
|
||||
print "</div>\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 = '<a href="'.dol_buildpath('/asset/list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Number of files
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
|
||||
// Total size
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
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
|
||||
|
||||
@ -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');
|
||||
}
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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 .= '<br><b>'.$langs->trans('Note').':</b> '.(dol_textishtml($this->note_private) ? str_replace(array("\r", "\n"), "", $this->note_private) : str_replace(array("\r", "\n"), '<br>', $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;
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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 = "<a href=\"?year=".$prev_year."&month=".$prev_month.$param."\"><i class=\"fa fa-chevron-left\"></i></a> \n";
|
||||
$nav = "<a href=\"?year=".$prev_year."&month=".$prev_month.$param."\"><i class=\"fa fa-chevron-left\"></i></a> \n";
|
||||
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, 1, $year), "%b %Y");
|
||||
$nav .= " </span>\n";
|
||||
$nav .= " <a href=\"?year=".$next_year."&month=".$next_month.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n";
|
||||
$nav .= " <a href=\"?year=".$next_year."&month=".$next_month.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n";
|
||||
if (empty($conf->dol_optimize_smallscreen)) {
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth.$param."\">".$langs->trans("Today")."</a> ";
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth.$param."\">".$langs->trans("Today")."</a> ";
|
||||
}
|
||||
$picto = 'calendar';
|
||||
}
|
||||
if ($action == 'show_week')
|
||||
{
|
||||
$nav = "<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\"><i class=\"fa fa-chevron-left\" title=\"".dol_escape_htmltag($langs->trans("Previous"))."\"></i></a> \n";
|
||||
$nav = "<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\"><i class=\"fa fa-chevron-left\" title=\"".dol_escape_htmltag($langs->trans("Previous"))."\"></i></a> \n";
|
||||
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("Week")." ".$week;
|
||||
$nav .= " </span>\n";
|
||||
$nav .= " <a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\" title=\"".dol_escape_htmltag($langs->trans("Next"))."\"></i></a>\n";
|
||||
$nav .= " <a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\" title=\"".dol_escape_htmltag($langs->trans("Next"))."\"></i></a>\n";
|
||||
if (empty($conf->dol_optimize_smallscreen)) {
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
|
||||
}
|
||||
$picto = 'calendarweek';
|
||||
}
|
||||
if ($action == 'show_day')
|
||||
{
|
||||
$nav = "<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\"><i class=\"fa fa-chevron-left\"></i></a> \n";
|
||||
$nav = "<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."aaa\"><i class=\"fa fa-chevron-left\"></i></a> \n";
|
||||
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "daytextshort");
|
||||
$nav .= " </span>\n";
|
||||
$nav .= " <a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n";
|
||||
$nav .= " <a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n";
|
||||
if (empty($conf->dol_optimize_smallscreen)) {
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
|
||||
}
|
||||
@ -394,6 +393,7 @@ $nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
|
||||
$nav .= '<button type="submit" class="liste_titre button_search" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
|
||||
|
||||
// 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 '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
//print dol_get_fiche_end();
|
||||
|
||||
$viewmode = '';
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1">';
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("List"), 'object_list-alt', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewList").'</span></a>';
|
||||
|
||||
$viewmode .= '<a class="btnTitle'.($action == 'show_month' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$viewmode .= '<a class="btnTitle'.($action == 'show_month' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewCal").'</span></a>';
|
||||
|
||||
$viewmode .= '<a class="btnTitle'.($action == 'show_week' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$viewmode .= '<a class="btnTitle'.($action == 'show_week' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewWeek").'</span></a>';
|
||||
|
||||
$viewmode .= '<a class="btnTitle'.($action == 'show_day' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$viewmode .= '<a class="btnTitle'.($action == 'show_day' ? ' btnTitleSelected' : '').' reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewDay").'</span></a>';
|
||||
|
||||
$viewmode .= '<a class="btnTitle reposition marginrightonly" href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$viewmode .= '<a class="btnTitle reposition marginrightonly" href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
@ -486,8 +487,8 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on
|
||||
$s .= "\n".'<!-- Div to calendars selectors -->'."\n";
|
||||
$s .= '<script type="text/javascript">'."\n";
|
||||
$s .= 'jQuery(document).ready(function () {'."\n";
|
||||
$s .= 'jQuery(".check_birthday").click(function() { console.log("Toggle birthday"); jQuery(".family_birthday").toggle(); });'."\n";
|
||||
$s .= 'jQuery(".family_birthday").toggle();'."\n";
|
||||
$s .= 'jQuery(".check_birthday").click(function() { console.log("Toggle birthdays"); jQuery(".family_birthday").toggle(); });'."\n";
|
||||
$s .= 'jQuery(".check_holiday").click(function() { console.log("Toggle holidays"); jQuery(".family_holiday").toggle(); });'."\n";
|
||||
if ($action == "show_week" || $action == "show_month" || empty($action))
|
||||
{
|
||||
// Code to enable drag and drop
|
||||
@ -509,6 +510,9 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on
|
||||
// Local calendar
|
||||
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans("LocalAgenda").' </div>';
|
||||
|
||||
// Holiday calendar
|
||||
$s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_holiday" name="check_holiday" class="check_holiday"><label for="check_holiday"> <span class="check_holiday_text">'.$langs->trans("Holidays").'</span></label> </div>';
|
||||
|
||||
// External calendars
|
||||
if (is_array($showextcals) && count($showextcals) > 0)
|
||||
{
|
||||
@ -541,6 +545,8 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on
|
||||
{
|
||||
$s = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
$s .= "\n".'<!-- End div to calendars selectors -->'."\n";
|
||||
} else // If javascript off
|
||||
{
|
||||
$newparam = $param; // newparam is for birthday links
|
||||
@ -554,9 +560,12 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on
|
||||
$link .= '</a>';
|
||||
}
|
||||
|
||||
|
||||
// Load events from database into $eventarray
|
||||
$eventarray = array();
|
||||
|
||||
|
||||
// DEFAULT CALENDAR + AUTOEVENT CALENDAR + CONFERENCEBOOTH CALENDAR
|
||||
$sql = 'SELECT ';
|
||||
if ($usergroup > 0) $sql .= " DISTINCT";
|
||||
$sql .= ' a.id, a.label,';
|
||||
@ -567,7 +576,7 @@ $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_project,';
|
||||
$sql .= ' a.fk_element, a.elementtype,';
|
||||
$sql .= ' ca.code as type_code, ca.libelle as type_label, ca.color as type_color';
|
||||
$sql .= ' ca.code as type_code, ca.libelle as type_label, ca.color as type_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
|
||||
@ -685,13 +694,17 @@ if ($resql)
|
||||
$event->type_code = $obj->type_code;
|
||||
$event->type_label = $obj->type_label;
|
||||
$event->type_color = $obj->type_color;
|
||||
$event->type = $obj->type_type;
|
||||
$event->type_picto = $obj->type_picto;
|
||||
|
||||
$event->libelle = $obj->label; // deprecated
|
||||
$event->label = $obj->label;
|
||||
$event->percentage = $obj->percent;
|
||||
|
||||
$event->authorid = $obj->fk_user_author; // user id of creator
|
||||
$event->userownerid = $obj->fk_user_action; // user id of owner
|
||||
$event->fetch_userassigned(); // This load $event->userassigned
|
||||
|
||||
$event->priority = $obj->priority;
|
||||
$event->fulldayevent = $obj->fulldayevent;
|
||||
$event->location = $obj->location;
|
||||
@ -752,6 +765,7 @@ if ($resql)
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// BIRTHDATES CALENDAR
|
||||
// Complete $eventarray with birthdates
|
||||
if ($showbirthday)
|
||||
{
|
||||
@ -778,6 +792,7 @@ if ($showbirthday)
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$event = new ActionComm($db);
|
||||
|
||||
$event->id = $obj->rowid; // We put contact id in action id for birthdays events
|
||||
@ -788,28 +803,39 @@ if ($showbirthday)
|
||||
$datearray = dol_getdate($datebirth, true);
|
||||
$event->datep = dol_mktime(0, 0, 0, $datearray['mon'], $datearray['mday'], $year, true); // For full day events, date are also GMT but they wont but converted during output
|
||||
$event->datef = $event->datep;
|
||||
|
||||
$event->type_code = 'BIRTHDAY';
|
||||
$event->type_label = '';
|
||||
$event->type_color = '';
|
||||
$event->type = 'birthdate';
|
||||
$event->type_picto = 'birthdate';
|
||||
|
||||
$event->label = $langs->trans("Birthday").' '.dolGetFirstLastname($obj->firstname, $obj->lastname);
|
||||
$event->percentage = 100;
|
||||
$event->fulldayevent = 1;
|
||||
|
||||
$event->date_start_in_calendar = $event->datep;
|
||||
$event->date_end_in_calendar = $event->datef;
|
||||
$event->date_start_in_calendar = $db->jdate($event->datep);
|
||||
$event->date_end_in_calendar = $db->jdate($event->datef);
|
||||
$event->ponctuel = 0;
|
||||
|
||||
// Add an entry in actionarray for each day
|
||||
$daycursor = $event->date_start_in_calendar;
|
||||
$annee = dol_print_date($daycursor, '%Y');
|
||||
$mois = dol_print_date($daycursor, '%m');
|
||||
$jour = dol_print_date($daycursor, '%d');
|
||||
// Add an entry in eventarray for each day
|
||||
$daycursor = $event->datep;
|
||||
$annee = dol_print_date($daycursor, '%Y', 'tzuserrel');
|
||||
$mois = dol_print_date($daycursor, '%m', 'tzuserrel');
|
||||
$jour = dol_print_date($daycursor, '%d', 'tzuserrel');
|
||||
|
||||
$loop = true;
|
||||
$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt');
|
||||
|
||||
$eventarray[$daykey][] = $event;
|
||||
|
||||
/*$loop = true;
|
||||
$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee);
|
||||
do {
|
||||
$eventarray[$daykey][] = $event;
|
||||
$daykey += 60 * 60 * 24;
|
||||
if ($daykey > $event->date_end_in_calendar) $loop = false;
|
||||
} while ($loop);
|
||||
*/
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
@ -817,89 +843,85 @@ if ($showbirthday)
|
||||
}
|
||||
}
|
||||
|
||||
if ($conf->global->AGENDA_SHOW_HOLIDAYS)
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE u.rowid = x.fk_user";
|
||||
$sql .= " AND u.statut = '1'"; // Show only active users (0 = inactive user, 1 = active user)
|
||||
$sql .= " AND (x.statut = '2' OR x.statut = '3')"; // Show only public leaves (2 = leave wait for approval, 3 = leave approved)
|
||||
|
||||
if ($action == 'show_day') {
|
||||
// Request only leaves for the current selected day
|
||||
$sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date wihout time
|
||||
} elseif ($action == 'show_week') {
|
||||
// TODO: Add filter to reduce database request
|
||||
} elseif ($action == 'show_month') {
|
||||
// TODO: Add filter to reduce database request
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE u.rowid = x.fk_user";
|
||||
$sql .= " AND u.statut = '1'"; // Show only active users (0 = inactive user, 1 = active user)
|
||||
$sql .= " AND (x.statut = '2' OR x.statut = '3')"; // Show only public leaves (2 = leave wait for approval, 3 = leave approved)
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
if ($action == 'show_day')
|
||||
while ($i < $num)
|
||||
{
|
||||
// Request only leaves for the current selected day
|
||||
$sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin";
|
||||
} elseif ($action == 'show_week')
|
||||
{
|
||||
// TODO: Add filter to reduce database request
|
||||
} elseif ($action == 'show_month')
|
||||
{
|
||||
// TODO: Add filter to reduce database request
|
||||
}
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$event = new ActionComm($db);
|
||||
|
||||
while ($i < $num)
|
||||
// Need the id of the leave object for link to it
|
||||
$event->id = $obj->rowid;
|
||||
$event->ref = $event->id;
|
||||
|
||||
$event->type_code = 'HOLIDAY';
|
||||
$event->type_label = '';
|
||||
$event->type_color = '';
|
||||
$event->type = 'holiday';
|
||||
$event->type_picto = 'holiday';
|
||||
|
||||
$event->datep = $db->jdate($obj->date_start);
|
||||
$event->datef = $db->jdate($obj->date_end);
|
||||
$event->date_start_in_calendar = $event->datep;
|
||||
$event->date_end_in_calendar = $event->datef;
|
||||
|
||||
if ($obj->status == 3)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$dateStartArray = dol_getdate(dol_stringtotime($obj->date_start, 1), true);
|
||||
$dateEndArray = dol_getdate(dol_stringtotime($obj->date_end, 1), true);
|
||||
|
||||
$event = new ActionComm($db);
|
||||
|
||||
// Need the id of the leave object for link to it
|
||||
$event->id = $obj->rowid;
|
||||
$event->ref = $event->id;
|
||||
|
||||
$event->type_code = 'HOLIDAY';
|
||||
$event->datep = dol_mktime(0, 0, 0, $dateStartArray['mon'], $dateStartArray['mday'], $dateStartArray['year'], true);
|
||||
$event->datef = dol_mktime(0, 0, 0, $dateEndArray['mon'], $dateEndArray['mday'], $dateEndArray['year'], true);
|
||||
$event->date_start_in_calendar = $event->datep;
|
||||
$event->date_end_in_calendar = $event->datef;
|
||||
|
||||
if ($obj->status == 3)
|
||||
{
|
||||
// Show no symbol for leave with state "leave approved"
|
||||
$event->percentage = -1;
|
||||
} elseif ($obj->status == 2)
|
||||
{
|
||||
// Show TO-DO symbol for leave with state "leave wait for approval"
|
||||
$event->percentage = 0;
|
||||
}
|
||||
|
||||
if ($obj->halfday == 1)
|
||||
{
|
||||
$event->label = $obj->lastname.' ('.$langs->trans("Morning").')';
|
||||
} elseif ($obj->halfday == -1)
|
||||
{
|
||||
$event->label = $obj->lastname.' ('.$langs->trans("Afternoon").')';
|
||||
} else {
|
||||
$event->label = $obj->lastname;
|
||||
}
|
||||
|
||||
$daycursor = $event->date_start_in_calendar;
|
||||
$annee = dol_print_date($daycursor, '%Y');
|
||||
$mois = dol_print_date($daycursor, '%m');
|
||||
$jour = dol_print_date($daycursor, '%d');
|
||||
|
||||
$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee);
|
||||
|
||||
do {
|
||||
$eventarray[$daykey][] = $event;
|
||||
|
||||
$daykey += 60 * 60 * 24;
|
||||
} while ($daykey <= $event->date_end_in_calendar);
|
||||
|
||||
$i++;
|
||||
// Show no symbol for leave with state "leave approved"
|
||||
$event->percentage = -1;
|
||||
} elseif ($obj->status == 2)
|
||||
{
|
||||
// Show TO-DO symbol for leave with state "leave wait for approval"
|
||||
$event->percentage = 0;
|
||||
}
|
||||
|
||||
if ($obj->halfday == 1)
|
||||
{
|
||||
$event->label = $obj->lastname.' ('.$langs->trans("Morning").')';
|
||||
} elseif ($obj->halfday == -1)
|
||||
{
|
||||
$event->label = $obj->lastname.' ('.$langs->trans("Afternoon").')';
|
||||
} else {
|
||||
$event->label = $obj->lastname;
|
||||
}
|
||||
|
||||
$daycursor = $event->date_start_in_calendar;
|
||||
$annee = dol_print_date($daycursor, '%Y', 'tzuserrel');
|
||||
$mois = dol_print_date($daycursor, '%m', 'tzuserrel');
|
||||
$jour = dol_print_date($daycursor, '%d', 'tzuserrel');
|
||||
|
||||
$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt');
|
||||
do {
|
||||
$eventarray[$daykey][] = $event;
|
||||
|
||||
$daykey += 60 * 60 * 24;
|
||||
} while ($daykey <= $event->date_end_in_calendar);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
// EXTERNAL CALENDAR
|
||||
// Complete $eventarray with external import Ical
|
||||
if (count($listofextcals))
|
||||
{
|
||||
@ -911,7 +933,7 @@ if (count($listofextcals))
|
||||
$offsettz = $extcal['offsettz'];
|
||||
$colorcal = $extcal['color'];
|
||||
$buggedfile = $extcal['buggedfile'];
|
||||
//print "url=".$url." namecal=".$namecal." colorcal=".$colorcal." buggedfile=".$buggedfile;
|
||||
|
||||
$ical = new ICal();
|
||||
$ical->parse($url);
|
||||
|
||||
@ -1088,9 +1110,12 @@ if (count($listofextcals))
|
||||
$event->userassigned[$userId] = $userId;
|
||||
$event->percentage = -1;
|
||||
}
|
||||
else {
|
||||
$event->type_code = "ICALEVENT";
|
||||
}
|
||||
|
||||
$event->type_code = "ICALEVENT";
|
||||
$event->type_label = $namecal;
|
||||
$event->type_color = $colorcal;
|
||||
$event->type = 'icalevent';
|
||||
$event->type_picto = 'rss';
|
||||
|
||||
$event->icalname = $namecal;
|
||||
$event->icalcolor = $colorcal;
|
||||
@ -1149,15 +1174,15 @@ if (count($listofextcals))
|
||||
|
||||
// Add an entry in actionarray for each day
|
||||
$daycursor = $event->date_start_in_calendar;
|
||||
$annee = date('Y', $daycursor);
|
||||
$mois = date('m', $daycursor);
|
||||
$jour = date('d', $daycursor);
|
||||
$annee = dol_print_date($daycursor, '%Y', 'tzuserrel');
|
||||
$mois = dol_print_date($daycursor, '%m', 'tzuserrel');
|
||||
$jour = dol_print_date($daycursor, '%d', 'tzuserrel');
|
||||
|
||||
// Loop on each day covered by action to prepare an index to show on calendar
|
||||
$loop = true; $j = 0;
|
||||
// daykey must be date that represent day box in calendar so must be a user time
|
||||
$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee);
|
||||
$daykeygmt = dol_mktime(0, 0, 0, $mois, $jour, $annee, true, 0);
|
||||
$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt');
|
||||
$daykeygmt = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt');
|
||||
do {
|
||||
//if ($event->fulldayevent) print dol_print_date($daykeygmt,'dayhour','gmt').'-'.dol_print_date($daykey,'dayhour','gmt').'-'.dol_print_date($event->date_end_in_calendar,'dayhour','gmt').' ';
|
||||
$eventarray[$daykey][] = $event;
|
||||
@ -1205,9 +1230,11 @@ if (is_readable($color_file))
|
||||
}
|
||||
if (!is_array($theme_datacolor)) $theme_datacolor = array(array(120, 130, 150), array(200, 160, 180), array(190, 190, 220));
|
||||
|
||||
$massactionbutton ='';
|
||||
|
||||
print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1, 'object_action', 0, $nav.'<span class="marginleftonly"></span>'.$newcardbutton, '', $limit, 1, 0, 1, $viewmode);
|
||||
|
||||
// Show div with list of calendars
|
||||
print $s;
|
||||
|
||||
|
||||
@ -1343,14 +1370,14 @@ if (empty($action) || $action == 'show_month') // View by month
|
||||
|
||||
for ($iter_day = 0; $iter_day < 7; $iter_day++) {
|
||||
// Show days of the current week
|
||||
$curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd');
|
||||
$tmparray = dol_getdate($curtime, true);
|
||||
$tmpday = $tmparray['mday'];
|
||||
$tmpmonth = $tmparray['mon'];
|
||||
$tmpyear = $tmparray['year'];
|
||||
$curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); // $firstdaytoshow is in timezone of server
|
||||
$tmpday = dol_print_date($curtime, '%d', 'tzuserrel');
|
||||
$tmpmonth = dol_print_date($curtime, '%m', 'tzuserrel');
|
||||
$tmpyear = dol_print_date($curtime, '%Y', 'tzuserrel');
|
||||
|
||||
$style = 'cal_current_month';
|
||||
if ($iter_day == 6) $style .= ' cal_other_month_right';
|
||||
|
||||
$today = 0;
|
||||
$todayarray = dol_getdate($now, 'fast');
|
||||
if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $tmpmonth && $todayarray['year'] == $tmpyear) $today = 1;
|
||||
@ -1486,6 +1513,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
global $theme_datacolor;
|
||||
global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
|
||||
|
||||
if ($conf->use_javascript_ajax) { // Enable the "Show more button..."
|
||||
$conf->global->MAIN_JS_SWITCH_AGENDA = 1;
|
||||
}
|
||||
|
||||
$dateint = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $day);
|
||||
|
||||
print "\n";
|
||||
@ -1501,11 +1532,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
}
|
||||
|
||||
// Line with title of day
|
||||
print '<div id="dayevent_'.$dateint.'" class="cursorpointer dayevent tagtable centpercent nobordernopadding" onclick="window.location=\''.$urltocreate.'\';">'."\n";
|
||||
print '<div id="dayevent_'.$dateint.'" class="dayevent tagtable centpercent nobordernopadding">'."\n";
|
||||
|
||||
if ($nonew <= 0)
|
||||
{
|
||||
print '<div class="tagtr"><div class="nowrap tagtd"><div class="left inline-block">';
|
||||
print '<div class="tagtr cursorpointer" onclick="window.location=\''.$urltocreate.'\';"><div class="nowrap tagtd"><div class="left inline-block">';
|
||||
print '<a class="dayevent-aday" style="color: #666" href="'.$urltoshow.'">';
|
||||
if ($showinfo) print dol_print_date($curtime, 'daytextshort');
|
||||
else print dol_print_date($curtime, '%d');
|
||||
@ -1531,13 +1562,16 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
print '<div class="tagtd centpercent agendacell sortable">';
|
||||
|
||||
//$curtime = dol_mktime (0, 0, 0, $month, $day, $year);
|
||||
$i = 0; $numother = 0; $numbirthday = 0; $numical = 0; $numicals = array();
|
||||
$i = 0; $ireallyshown = 0; $itoshow = 0; $numother = 0; $numbirthday = 0; $numical = 0; $numicals = array();
|
||||
$ymd = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $day);
|
||||
|
||||
$colorindexused[$user->id] = 0; // Color index for current user (user->id) is always 0
|
||||
$nextindextouse = is_array($colorindexused) ?count($colorindexused) : 0; // At first run this is 0, so fist user has 0, next 1, ...
|
||||
//var_dump($colorindexused);
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
||||
$tmpholiday = new Holiday($db);
|
||||
|
||||
foreach ($eventarray as $daykey => $notused)
|
||||
{
|
||||
$annee = dol_print_date($daykey, '%Y');
|
||||
@ -1583,7 +1617,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$cssclass = (!empty($event->icalname) ? 'family_ext'.md5($event->icalname) : 'family_other');
|
||||
} elseif ($event->type_code == 'BIRTHDAY')
|
||||
{
|
||||
$numbirthday++; $colorindex = 2; $cssclass = 'family_birthday unmovable'; $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
|
||||
$numbirthday++; $colorindex = 2; $cssclass = 'family_birthday '; $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
|
||||
} else {
|
||||
$numother++;
|
||||
$color = ($event->icalcolor ? $event->icalcolor : -1);
|
||||
@ -1617,20 +1651,22 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
// Define color
|
||||
$color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
|
||||
}
|
||||
$cssclass = $cssclass.' '.$cssclass.'_day_'.$ymd;
|
||||
$cssclass = $cssclass.' eventday_'.$ymd;
|
||||
|
||||
// Defined style to disable drag and drop feature
|
||||
if ($event->type_code == 'AC_OTH_AUTO')
|
||||
{
|
||||
if ($event->type_code == 'AC_OTH_AUTO') {
|
||||
$cssclass .= " unmovable";
|
||||
} elseif ($event->type_code == 'ICALEVENT')
|
||||
{
|
||||
} elseif ($event->type_code == 'HOLIDAY') {
|
||||
$cssclass .= " unmovable";
|
||||
} elseif ($event->type_code == 'BIRTHDAY') {
|
||||
$cssclass .= " unmovable";
|
||||
} elseif ($event->type_code == 'ICALEVENT') {
|
||||
$cssclass .= " unmovable";
|
||||
} elseif ($event->date_end_in_calendar && date('Ymd', $event->date_start_in_calendar) != date('Ymd', $event->date_end_in_calendar)) {
|
||||
$tmpyearend = date('Y', $event->date_end_in_calendar);
|
||||
$tmpmonthend = date('m', $event->date_end_in_calendar);
|
||||
$tmpdayend = date('d', $event->date_end_in_calendar);
|
||||
if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour)
|
||||
if ($tmpyearend != $annee || $tmpmonthend != $mois || $tmpdayend != $jour)
|
||||
{
|
||||
$cssclass .= " unmovable";
|
||||
}
|
||||
@ -1648,10 +1684,29 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
if ($action == 'show_day') { $h = 'height: 100%; '; $nowrapontd = 0; }
|
||||
if ($action == 'show_week') { $h = 'height: 100%; '; $nowrapontd = 0; }
|
||||
|
||||
// Show rect of event
|
||||
// Show event box
|
||||
print "\n";
|
||||
print '<!-- start event '.$i.' -->'."\n";
|
||||
print '<div id="event_'.$ymd.'_'.$i.'" class="event '.$cssclass.'"';
|
||||
|
||||
$morecss = '';
|
||||
if ($maxprint && $ireallyshown >= $maxprint) {
|
||||
$morecss = 'showifmore';
|
||||
}
|
||||
if ($event->type == 'birthdate' && !GETPOST('check_birthday')) {
|
||||
$morecss = 'hidden';
|
||||
}
|
||||
if ($event->type == 'holiday' && !GETPOST('check_holiday')) {
|
||||
$morecss = 'hidden';
|
||||
}
|
||||
if ($morecss != 'hidden') {
|
||||
$itoshow++;
|
||||
}
|
||||
if ($morecss != 'showifmore' && $morecss != 'hidden') {
|
||||
$ireallyshown++;
|
||||
}
|
||||
//var_dump($event->type.' - '.$morecss.' - '.$cssclass.' - '.$i.' - '.$ireallyshown.' - '.$itoshow);
|
||||
|
||||
print '<div id="event_'.$ymd.'_'.$i.'" class="event family_'.$event->type.' '.$cssclass.($morecss ? ' '.$morecss : '').'"';
|
||||
//print ' style="height: 100px;';
|
||||
//print ' position: absolute; top: 40px; width: 50%;';
|
||||
//print '"';
|
||||
@ -1686,14 +1741,23 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
|
||||
$daterange = '';
|
||||
|
||||
if ($event->type_code == 'BIRTHDAY') // It's a birthday
|
||||
{
|
||||
if ($event->type_code == 'BIRTHDAY') { // It's birthday calendar
|
||||
print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact');
|
||||
} elseif ($event->type_code == 'HOLIDAY')
|
||||
{
|
||||
print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'holiday', 'user');
|
||||
} elseif ($event->type_code != 'BIRTHDAY' && $event->type_code != 'HOLIDAY')
|
||||
{
|
||||
} elseif ($event->type_code == 'HOLIDAY') { // It's holiday calendar
|
||||
$tmpholiday->fetch($event->id);
|
||||
|
||||
print $tmpholiday->getNomUrl(1);
|
||||
|
||||
$tmpid = $tmpholiday->fk_user;
|
||||
if (empty($cacheusers[$tmpid])) {
|
||||
$newuser = new User($db);
|
||||
$newuser->fetch($tmpid);
|
||||
$cacheusers[$tmpid] = $newuser;
|
||||
}
|
||||
|
||||
$listofusertoshow .= '<br>'.$cacheusers[$tmpid]->getNomUrl(-3, '', 0, 0, 0, 0, '', 'paddingright valigntextbottom');
|
||||
print $listofusertoshow;
|
||||
} else { // Other calendar
|
||||
// Picto
|
||||
if (empty($event->fulldayevent))
|
||||
{
|
||||
@ -1737,8 +1801,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$daterange .= dol_print_date($event->date_end_in_calendar, 'hour', 'tzuserrel');
|
||||
}
|
||||
} else {
|
||||
if ($showinfo)
|
||||
{
|
||||
if ($showinfo) {
|
||||
print $langs->trans("EventOnFullDay")."<br>\n";
|
||||
}
|
||||
}
|
||||
@ -1752,7 +1815,8 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$event->label = $titletoshow;
|
||||
$event->libelle = $titletoshow;
|
||||
// Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user.
|
||||
$titletoshow = $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title', '', 0, 0);
|
||||
$titletoshow = (($event->type_picto || $event->type_code) ? $event->getTypePicto() : '');
|
||||
$titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title', '', 0, 0);
|
||||
$event->label = $savlabel;
|
||||
$event->libelle = $savlabel;
|
||||
}
|
||||
@ -1764,8 +1828,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
{
|
||||
if (!$posuserassigned && $titletoshow) $listofusertoshow .= '<br>';
|
||||
$posuserassigned++;
|
||||
if (empty($cacheusers[$tmpid]))
|
||||
{
|
||||
if (empty($cacheusers[$tmpid])) {
|
||||
$newuser = new User($db);
|
||||
$newuser->fetch($tmpid);
|
||||
$cacheusers[$tmpid] = $newuser;
|
||||
@ -1837,6 +1900,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
else print ' ';
|
||||
print '</td></tr></table>';
|
||||
print '</div><!-- end event '.$i.' -->'."\n";
|
||||
|
||||
$i++;
|
||||
} else {
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action='.$action.'&maxprint=0&month='.$monthshown.'&year='.$year;
|
||||
@ -1859,22 +1923,25 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
print ' ';
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_JS_SWITCH_AGENDA) && $i > $maxprint && $maxprint)
|
||||
if (!empty($conf->global->MAIN_JS_SWITCH_AGENDA) && $itoshow > $ireallyshown && $maxprint)
|
||||
{
|
||||
print '<div id="more_'.$ymd.'">'.img_picto("all", "1downarrow_selected.png").' +'.$langs->trans("More").'...</div>';
|
||||
print '<div class="center cursorpointer" id="more_'.$ymd.'">'.img_picto("All", "angle-double-down", 'class="warning"').' +'.($itoshow - $ireallyshown).'</div>';
|
||||
//print ' +'.(count($eventarray[$daykey])-$maxprint);
|
||||
|
||||
print '<script type="text/javascript">'."\n";
|
||||
print 'jQuery(document).ready(function () {'."\n";
|
||||
print 'jQuery("#more_'.$ymd.'").click(function() { reinit_day_'.$ymd.'(); });'."\n";
|
||||
|
||||
print 'function reinit_day_'.$ymd.'() {'."\n";
|
||||
print 'var nb=0;'."\n";
|
||||
// TODO Loop on each element of day $ymd and start to toggle once $maxprint has been reached
|
||||
print 'jQuery(".family_mytasks_day_'.$ymd.'").toggle();';
|
||||
print '}'."\n";
|
||||
|
||||
print ' var open=0;'."\n";
|
||||
print ' jQuery("#more_'.$ymd.'").click(function() { console.log("Click on showmore for '.$ymd.'"); reinit_day_'.$ymd.'(); event.stopImmediatePropagation(); });'."\n";
|
||||
print ' function reinit_day_'.$ymd.'() {'."\n";
|
||||
print ' jQuery(".eventday_'.$ymd.'.showifmore").toggle();'."\n";
|
||||
print ' open = open + 1; if (open > 1) { open = 0; }'."\n";
|
||||
print ' if (open) { ';
|
||||
print ' jQuery("#more_'.$ymd.'").html(\''.img_picto("All", "angle-double-up", 'class="warning"').'\');'."\n";
|
||||
print ' } else { ';
|
||||
print ' jQuery("#more_'.$ymd.'").html(\''.img_picto("All", "angle-double-down", 'class="warning"').' +'.($itoshow - $ireallyshown).'\');'."\n";
|
||||
print ' }'."\n";
|
||||
print ' }'."\n";
|
||||
print '});'."\n";
|
||||
|
||||
print '</script>'."\n";
|
||||
}
|
||||
|
||||
@ -1921,7 +1988,6 @@ function sort_events_by_date($a, $b)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ($b->type_code === 'HOLIDAY')
|
||||
{
|
||||
return 1;
|
||||
|
||||
@ -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 .= '<a class="btnTitle btnTitleSelected reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1">';
|
||||
$viewmode .= '<a class="btnTitle btnTitleSelected reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("List"), 'object_list-alt', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewList").'</span></a>';
|
||||
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewCal").'</span></a>';
|
||||
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewWeek").'</span></a>';
|
||||
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewDay").'</span></a>';
|
||||
|
||||
$viewmode .= '<a class="btnTitle reposition marginrightonly" href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$viewmode .= '<a class="btnTitle reposition marginrightonly" href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
@ -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);
|
||||
|
||||
@ -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 .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1">';
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("List"), 'object_list-alt', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewList").'</span></a>';
|
||||
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewCal").'</span></a>';
|
||||
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewWeek").'</span></a>';
|
||||
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewDay").'</span></a>';
|
||||
|
||||
$viewmode .= '<a class="btnTitle btnTitleSelected reposition marginrightonly" href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$viewmode .= '<a class="btnTitle btnTitleSelected reposition marginrightonly" href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
@ -430,6 +432,8 @@ print '</div>';
|
||||
// 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
|
||||
|
||||
@ -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 .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1">';
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/list.php?action=show_list&restore_lastsearch_values=1'.$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("List"), 'object_list-alt', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewList").'</span></a>';
|
||||
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewCal").'</span></a>';
|
||||
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewWeek").'</span></a>';
|
||||
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$viewmode .= '<a class="btnTitle reposition" href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
$viewmode .= '<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone">'.$langs->trans("ViewDay").'</span></a>';
|
||||
|
||||
$viewmode .= '<a class="btnTitle btnTitleSelected reposition marginrightonly" href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').'">';
|
||||
$viewmode .= '<a class="btnTitle btnTitleSelected reposition marginrightonly" href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep, '%Y').'&month='.dol_print_date($object->datep, '%m').'&day='.dol_print_date($object->datep, '%d').$paramnoactionodate.'">';
|
||||
//$viewmode .= '<span class="fa paddingleft imgforviewmode valignmiddle btnTitle-icon">';
|
||||
$viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"');
|
||||
//$viewmode .= '</span>';
|
||||
@ -435,10 +436,11 @@ print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $show
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
// 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
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2015-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
*
|
||||
@ -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 '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
print '<td class="nowraponall">';
|
||||
$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 '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
print '<td class="nowraponall">';
|
||||
print $commande_static->getNomUrl(1);
|
||||
print '</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->dc), 'day')."</td>\n";
|
||||
print '<td class="right" style="min-width: 60px">'.price($objp->total_ht).'</td>';
|
||||
@ -938,7 +937,7 @@ if ($object->id > 0)
|
||||
$sendingstatic->ref = $objp->ref;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
print '<td class="nowraponall">';
|
||||
print $sendingstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
if ($objp->date_creation > 0) {
|
||||
@ -1014,7 +1013,7 @@ if ($object->id > 0)
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
print '<td class="nowraponall">';
|
||||
print $contrat->getNomUrl(1, 12);
|
||||
print $late;
|
||||
print "</td>\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 '<tr class="oddeven">';
|
||||
print '<td class="nowrap"><a href="'.DOL_URL_ROOT.'/fichinter/card.php?id='.$objp->id.'">'.img_object($langs->trans("ShowPropal"), "propal").' '.$objp->ref.'</a></td>'."\n";
|
||||
print '<td class="nowraponall">';
|
||||
print $fichinter_static->getNomUrl(1);
|
||||
print '</td>'."\n";
|
||||
//print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->startdate)).'</td>'."\n";
|
||||
print '<td class="right" style="min-width: 60px">'.convertSecondToTime($objp->duration).'</td>'."\n";
|
||||
print '<td class="nowrap right" style="min-width: 60px">'.$fichinter_static->getLibStatut(5).'</td>'."\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 '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
print '<td class="nowraponall">';
|
||||
print $facturestatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
if ($objp->df > 0)
|
||||
@ -1273,7 +1276,7 @@ if ($object->id > 0)
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td class="nowrap right" style="min-width: 60px">'.($facturestatic->LibStatut($objp->paye, $objp->statut, 5, $objp->am)).'</td>';
|
||||
print '<td class="nowrap right" style="min-width: 60px">'.($facturestatic->LibStatut($objp->paye, $objp->status, 5, $objp->am)).'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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").",";
|
||||
|
||||
@ -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';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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 '<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['p.total_vat']['checked']))
|
||||
if (!empty($arrayfields['p.total_tva']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre right">';
|
||||
@ -881,7 +881,7 @@ if ($resql)
|
||||
print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['p.multicurrency_total_vat']['checked']))
|
||||
if (!empty($arrayfields['p.multicurrency_total_tva']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre right">';
|
||||
@ -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 '<td class="nowrap right">'.price($obj->total_vat)."</td>\n";
|
||||
print '<td class="nowrap right">'.price($obj->total_tva)."</td>\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 '<td class="right nowrap">'.price($obj->multicurrency_total_vat)."</td>\n";
|
||||
print '<td class="right nowrap">'.price($obj->multicurrency_total_tva)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Amount TTC
|
||||
|
||||
@ -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").",";
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -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 = '<a href="'.DOL_URL_ROOT.'/commande/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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 '<td class="tdoverflowmax150">';
|
||||
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 '<td class="tdoverflowmax150">';
|
||||
|
||||
$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 '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Bank account
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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'";
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -4756,7 +4756,7 @@ if ($action == 'create')
|
||||
$paymentstatic->num_payment = $objp->num_payment;
|
||||
$paymentstatic->payment_code = $objp->payment_code;
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<tr class="oddeven"><td class="nowraponall">';
|
||||
print $paymentstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
@ -4785,7 +4785,7 @@ if ($action == 'create')
|
||||
$bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
|
||||
}
|
||||
|
||||
print '<td class="right">';
|
||||
print '<td class="nowraponall">';
|
||||
if ($bankaccountstatic->id)
|
||||
print $bankaccountstatic->getNomUrl(1, 'transactions');
|
||||
print '</td>';
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -1376,7 +1376,7 @@ if ($resql)
|
||||
// Alias
|
||||
if (!empty($arrayfields['s.name_alias']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print '<td class="tdoverflowmax150" title="'.$obj->name_alias.'">';
|
||||
print $obj->name_alias;
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -508,19 +508,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
print '<tr><td>'.$langs->trans('Numero');
|
||||
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||
print '</td>';
|
||||
print '<td><input name="num_paiement" type="text" value="'.$paymentnum.'"></td></tr>';
|
||||
print '<td><input name="num_paiement" type="text" class="maxwidth200" value="'.$paymentnum.'"></td></tr>';
|
||||
|
||||
// Check transmitter
|
||||
print '<tr><td class="'.(GETPOST('paiementcode') == 'CHQ' ? 'fieldrequired ' : '').'fieldrequireddyn">'.$langs->trans('CheckTransmitter');
|
||||
print ' <em>('.$langs->trans("ChequeMaker").')</em>';
|
||||
print '</td>';
|
||||
print '<td><input id="fieldchqemetteur" name="chqemetteur" size="30" type="text" value="'.GETPOST('chqemetteur', 'alphanohtml').'"></td></tr>';
|
||||
print '<td><input id="fieldchqemetteur" class="maxwidth300" name="chqemetteur" type="text" value="'.GETPOST('chqemetteur', 'alphanohtml').'"></td></tr>';
|
||||
|
||||
// Bank name
|
||||
print '<tr><td>'.$langs->trans('Bank');
|
||||
print ' <em>('.$langs->trans("ChequeBank").')</em>';
|
||||
print '</td>';
|
||||
print '<td><input name="chqbank" size="30" type="text" value="'.GETPOST('chqbank', 'alphanohtml').'"></td></tr>';
|
||||
print '<td><input name="chqbank" class="maxwidth300" type="text" value="'.GETPOST('chqbank', 'alphanohtml').'"></td></tr>';
|
||||
|
||||
// Comments
|
||||
print '<tr><td>'.$langs->trans('Comments').'</td>';
|
||||
@ -578,6 +578,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
$i = 0;
|
||||
//print '<tr><td colspan="3">';
|
||||
print '<br>';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -786,7 +788,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
print "</tr>\n";
|
||||
}
|
||||
print "</table>";
|
||||
//print "</td></tr>\n";
|
||||
print "</div>\n";
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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 '<br><!-- Link to download main doc -->'."\n";
|
||||
print showDirectDownloadLink($object).'<br>';
|
||||
}
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015-2019 Frederic France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2015-2021 Frederic France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
|
||||
*
|
||||
* 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";
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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 .= '<input type="submit" name="confirmmassactioninvisible" style="display: none" tabindex="-1">'; // Hidden button BEFORE so it is the one used when we submit with ENTER.
|
||||
$ret .= '<input type="submit" disabled name="confirmmassaction" class="button'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'confirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">';
|
||||
$ret .= '<input type="submit" disabled name="confirmmassaction"'.(empty($conf->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 .= '</div>';
|
||||
|
||||
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 .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';
|
||||
$retstring .= ($disabled ? ' disabled' : '');
|
||||
$retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
|
||||
$retstring .= '>';
|
||||
|
||||
// Icone calendar
|
||||
// Icon calendar
|
||||
$retstringbuttom = '';
|
||||
if (!$disabled) {
|
||||
$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
|
||||
@ -5912,8 +5915,7 @@ class Form
|
||||
{
|
||||
// Script which will be inserted in the onClick of the "Now" link
|
||||
$reset_scripts = "";
|
||||
if ($addnowlink == 2) // local computer time
|
||||
{
|
||||
if ($addnowlink == 2) { // local computer time
|
||||
// pad add leading 0 on numbers
|
||||
$reset_scripts .= "Number.prototype.pad = function(size) {
|
||||
var s = String(this);
|
||||
@ -5924,14 +5926,12 @@ class Form
|
||||
}
|
||||
|
||||
// Generate the date part, depending on the use or not of the javascript calendar
|
||||
if ($addnowlink == 1) // server time expressed in user time setup
|
||||
{
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day', 'tzuser').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d', 'tzuser').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m', 'tzuser').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y', 'tzuser').'\');';
|
||||
} elseif ($addnowlink == 2)
|
||||
{
|
||||
if ($addnowlink == 1) { // server time expressed in user time setup
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
|
||||
} elseif ($addnowlink == 2) {
|
||||
/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix.
|
||||
* This break application for foreign languages.
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(d.toLocaleDateString(\''.str_replace('_', '-', $langs->defaultlang).'\'));';
|
||||
@ -5939,10 +5939,10 @@ class Form
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';
|
||||
*/
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day', 'tzuser').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d', 'tzuser').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m', 'tzuser').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y', 'tzuser').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
|
||||
}
|
||||
/*if ($usecalendar == "eldy")
|
||||
{
|
||||
@ -5962,7 +5962,7 @@ class Form
|
||||
//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';
|
||||
if ($addnowlink == 1)
|
||||
{
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H', 'tzuser').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
|
||||
} elseif ($addnowlink == 2)
|
||||
{
|
||||
@ -5979,7 +5979,7 @@ class Form
|
||||
//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';
|
||||
if ($addnowlink == 1)
|
||||
{
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M', 'tzuser').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
|
||||
} elseif ($addnowlink == 2)
|
||||
{
|
||||
@ -6004,22 +6004,22 @@ class Form
|
||||
$reset_scripts = "";
|
||||
|
||||
// Generate the date part, depending on the use or not of the javascript calendar
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
|
||||
// Update the hour part
|
||||
if ($h)
|
||||
{
|
||||
if ($fullday) $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
|
||||
if ($fullday) $reset_scripts .= ' } ';
|
||||
}
|
||||
// Update the minute part
|
||||
if ($m)
|
||||
{
|
||||
if ($fullday) $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M').'\');';
|
||||
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
|
||||
if ($fullday) $reset_scripts .= ' } ';
|
||||
}
|
||||
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
|
||||
@ -6031,12 +6031,12 @@ class Form
|
||||
}
|
||||
}
|
||||
|
||||
// Add a "Plus one hour" link
|
||||
// Add a link to set data
|
||||
if ($conf->use_javascript_ajax && $adddateof)
|
||||
{
|
||||
$tmparray = dol_getdate($adddateof);
|
||||
if (empty($labeladddateof)) $labeladddateof = $langs->trans("DateInvoice");
|
||||
$retstring .= ' - <button class="dpInvisibleButtons datenowlink" id="dateofinvoice" type="button" name="_dateofinvoice" value="now" onclick="jQuery(\'#re\').val(\''.dol_print_date($adddateof, 'day').'\');jQuery(\'#reday\').val(\''.$tmparray['mday'].'\');jQuery(\'#remonth\').val(\''.$tmparray['mon'].'\');jQuery(\'#reyear\').val(\''.$tmparray['year'].'\');">'.$labeladddateof.'</a>';
|
||||
$retstring .= ' - <button class="dpInvisibleButtons datenowlink" id="dateofinvoice" type="button" name="_dateofinvoice" value="now" onclick="console.log(\'Click on now link\'); jQuery(\'#re\').val(\''.dol_print_date($adddateof, 'dayinputnoreduce').'\');jQuery(\'#reday\').val(\''.$tmparray['mday'].'\');jQuery(\'#remonth\').val(\''.$tmparray['mon'].'\');jQuery(\'#reyear\').val(\''.$tmparray['year'].'\');">'.$labeladddateof.'</a>';
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -77,7 +77,7 @@ class FormAdmin
|
||||
if ($showempty && !$multiselect)
|
||||
{
|
||||
$out .= '<option value="0"';
|
||||
if ($selected == '') $out .= ' selected';
|
||||
if ($selected === '') $out .= ' selected';
|
||||
$out .= '>';
|
||||
if ($showempty != '1') $out .= $showempty;
|
||||
else $out .= ' ';
|
||||
@ -86,7 +86,7 @@ class FormAdmin
|
||||
if ($showauto)
|
||||
{
|
||||
$out .= '<option value="auto"';
|
||||
if ($selected == 'auto') $out .= ' selected';
|
||||
if ($selected === 'auto') $out .= ' selected';
|
||||
$out .= '>'.$langs->trans("AutoDetectLang").'</option>';
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ class FormAdmin
|
||||
}
|
||||
|
||||
$valuetoshow .= ' '.picto_from_langcode($key, 'class="saturatemedium"');
|
||||
if ($selected == $keytouse) {
|
||||
if ((string) $selected == (string) $keytouse) {
|
||||
$out .= '<option value="'.$keytouse.'" selected data-html="'.dol_escape_htmltag($valuetoshow).'">'.$valuetoshow.'</option>';
|
||||
} else {
|
||||
$out .= '<option value="'.$keytouse.'" data-html="'.dol_escape_htmltag($valuetoshow).'">'.$valuetoshow.'</option>';
|
||||
|
||||
@ -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 .= '<form method="post" action="'.$page.'">';
|
||||
$out .= '<input type="hidden" name="action" value="set_thirdpartytype">';
|
||||
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@ -1042,8 +1041,7 @@ class FormCompany extends Form
|
||||
$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$out .= '</form>';
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,6 +247,18 @@ class FormTicket
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
print '<tr><td class="titlefield"><label for="email"><span class="fieldrequired">'.$langs->trans("SecurityCode").'</span></label></td><td>';
|
||||
print '<span class="span-icon-security inline-block">';
|
||||
print '<input id="securitycode" placeholder="'.$langs->trans("SecurityCode").'" class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" />';
|
||||
print '</span>';
|
||||
print '<span class="nowrap inline-block">';
|
||||
print '<img class="inline-block valignmiddle" src="'.DOL_URL_ROOT.'/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />';
|
||||
print '<a class="inline-block valignmiddle" href="'.$php_self.'" tabindex="4" data-role="button">'.img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"').'</a>';
|
||||
print '</span>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Attached files
|
||||
if (!empty($this->withfile)) {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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++;
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* Copyright (C) 2013-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Christophe Battarel <contact@altairis.fr>
|
||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2015-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
@ -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] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
|
||||
if ($nbContact > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
|
||||
}
|
||||
$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] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
|
||||
if ($nbContact > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
|
||||
}
|
||||
$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] .= '<span class="badge marginleftonlyshort">'.$nbProject.'</span>';
|
||||
}
|
||||
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
$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] .= '<span class="badge marginleftonlyshort">...</span>';
|
||||
elseif ($nbBankAccount > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbBankAccount.'</span>';
|
||||
if ($foundonexternalonlinesystem) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">...</span>';
|
||||
} elseif ($nbBankAccount > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbBankAccount.'</span>';
|
||||
}
|
||||
$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] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
if ($nbNote > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
}
|
||||
$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] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
if ($nbNotif > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNotif.'</span>';
|
||||
}
|
||||
$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] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
if ($nbNote > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
}
|
||||
$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] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
|
||||
if (($totalAttached) > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($totalAttached).'</span>';
|
||||
}
|
||||
$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] .= '<span class="badge marginleftonlyshort">'.$nbEvent.'</span>';
|
||||
}
|
||||
}
|
||||
$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 '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.(!empty($search[$key]) ? dol_escape_htmltag($search[$key]) : '').'">';
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.(!empty($search[$key]) ? dol_escape_htmltag($search[$key]) : '').'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
@ -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";
|
||||
|
||||
@ -99,10 +99,10 @@ function dol_print_cron_urls()
|
||||
// Cron launch
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print $langs->trans("URLToLaunchCronJobs").':<br>';
|
||||
$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').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
|
||||
print ' '.$langs->trans("OrToLaunchASpecificJob").'<br>';
|
||||
$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').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
@ -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')
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2009-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -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<br>";
|
||||
//print "memoryid=".$memoryid." - rescode=".$rescode." - count(response)=".count($data)."\n<br>";
|
||||
//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<br>";
|
||||
//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."<br>\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<br>\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."<br>\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;
|
||||
}
|
||||
|
||||
@ -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)."<br>";
|
||||
|
||||
$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."<br>";
|
||||
|
||||
// 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)
|
||||
|
||||
@ -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 <head> 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('<body id="bodywebsite" class="bodywebsite', '<body id="bodywebsite" class="bodywebsite '.$conf->global->WEBSITE_ADD_CSS_TO_BODY, $content);
|
||||
|
||||
@ -696,6 +696,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
|
||||
$substitarray = getCommonSubstitutionArray($langs, 0, null, null);
|
||||
|
||||
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
||||
|
||||
/**
|
||||
* We update newmenu with entries found into database
|
||||
* --------------------------------------------------
|
||||
@ -1451,7 +1453,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
$newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->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") {
|
||||
|
||||
@ -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++;
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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').")";
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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 '<table class="border centpercent">';
|
||||
|
||||
/*print '<tr>';
|
||||
print '<td width="20%" colspan="2">'.$langs->trans('Ref').'</td><td colspan="3">';
|
||||
print '<td width="20%">'.$langs->trans('Ref').'</td><td>';
|
||||
print $form->showrefnav($object,'id','',1,'rowid','ref');
|
||||
print '</td></tr>';*/
|
||||
|
||||
// Date of payment
|
||||
print '<tr><td class="titlefield" colspan="2">'.$form->editfieldkey("Date", 'datep', $object->date, $object, $object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">';
|
||||
print '<tr><td class="titlefield">'.$form->editfieldkey("Date", 'datep', $object->date, $object, $object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td>';
|
||||
print '<td>';
|
||||
print $form->editfieldval("Date", 'datep', $object->date, $object, $object->statut == 0 && $user->rights->fournisseur->facture->creer, 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded'));
|
||||
print '</td></tr>';
|
||||
|
||||
// Payment mode
|
||||
$labeltype = $langs->trans("PaymentType".$object->type_code) != ("PaymentType".$object->type_code) ? $langs->trans("PaymentType".$object->type_code) : $object->type_label;
|
||||
print '<tr><td colspan="2">'.$langs->trans('PaymentMode').'</td><td colspan="3">'.$labeltype;
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td>';
|
||||
print '<td>'.$labeltype;
|
||||
print $object->num_payment ? ' - '.$object->num_payment : '';
|
||||
print '</td></tr>';
|
||||
|
||||
// Payment numero
|
||||
/* TODO Add field num_payment into payment table and save it
|
||||
print '<tr><td colspan="2">'.$form->editfieldkey("Numero",'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">';
|
||||
print '<tr><td>'.$form->editfieldkey("Numero",'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td>';
|
||||
print '<td>';
|
||||
print $form->editfieldval("Numero",'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('PaymentNumberUpdateSucceeded'));
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
// Amount
|
||||
print '<tr><td colspan="2">'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->amount, '', $langs, 0, 0, -1, $conf->currency).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Amount').'</td>';
|
||||
print '<td>'.price($object->amount, '', $langs, 0, 0, -1, $conf->currency).'</td></tr>';
|
||||
|
||||
if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
||||
{
|
||||
print '<tr><td colspan="2">'.$langs->trans('Status').'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Status').'</td>';
|
||||
print '<td>'.$object->getLibStatut(4).'</td></tr>';
|
||||
}
|
||||
|
||||
$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 '<tr>';
|
||||
print '<td colspan="2">'.$langs->trans('BankAccount').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<td>'.$langs->trans('BankAccount').'</td>';
|
||||
print '<td>';
|
||||
$accountstatic = new Account($db);
|
||||
$accountstatic->fetch($bankline->fk_account);
|
||||
print $accountstatic->getNomUrl(1);
|
||||
@ -231,8 +247,8 @@ if ($result > 0)
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td colspan="2">'.$langs->trans('BankTransactionLine').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
||||
print '<td>';
|
||||
print $bankline->getNomUrl(1, 0, 'showconciliated');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -240,7 +256,8 @@ if ($result > 0)
|
||||
}
|
||||
|
||||
// Note
|
||||
print '<tr><td colspan="2">'.$form->editfieldkey("Note", 'note', $object->note, $object, $user->rights->fournisseur->facture->creer).'</td><td colspan="3">';
|
||||
print '<tr><td>'.$form->editfieldkey("Comments", 'note', $object->note, $object, $user->rights->fournisseur->facture->creer).'</td>';
|
||||
print '<td>';
|
||||
print $form->editfieldval("Note", 'note', $object->note, $object, $user->rights->fournisseur->facture->creer, 'textarea');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -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 = '<a href="'.DOL_URL_ROOT.'/fourn/paiement/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, -1, 'rowid', 'ref');
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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__,<br /><br />__(ThisIsContentOfYourOragnisationEventBulkMailToAttendes)__<br /><br />__(Sincerely)__<br />__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__,<br /><br />__(ThisIsContentOfYourOragnisationEventBulkMailToSpeakers)__<br /><br />__(Sincerely)__<br />__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,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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=<b>logint=%s</b> to restrict output to actions assigned to use
|
||||
AgendaUrlOptionsProject=<b>project=__PROJECT_ID__</b> to restrict output to actions linked to project <b>__PROJECT_ID__</b>.
|
||||
AgendaUrlOptionsNotAutoEvent=<b>notactiontype=systemauto</b> to exclude automatic events.
|
||||
AgendaUrlOptionsIncludeHolidays=<b>includeholidays=1</b> 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
|
||||
|
||||
@ -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 ?
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -130,7 +130,7 @@ AgendaUrlOptions4=<b>logint=%s</b>pour limiter l'export aux actions assignées
|
||||
AgendaUrlOptionsProject=<b>project=__PROJECT_ID__</b> pour restreindre aux événements associés au projet <b>__PROJECT_ID__</b>.
|
||||
AgendaUrlOptionsNotAutoEvent=<b>notactiontype=systemauto</b> pour exclure les événements automatiques.
|
||||
AgendaUrlOptionsIncludeHolidays=<b>includeholidays=1</b> 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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -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')))
|
||||
{
|
||||
|
||||
@ -772,9 +772,17 @@ class MyObject extends CommonObject
|
||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||
} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
if ($option == 'nolink') {
|
||||
$linkstart = '<span';
|
||||
} else {
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
}
|
||||
$linkstart .= $linkclose.'>';
|
||||
$linkend = '</a>';
|
||||
if ($option == 'nolink') {
|
||||
$linkend = '</span>';
|
||||
} else {
|
||||
$linkend = '</a>';
|
||||
}
|
||||
|
||||
$result .= $linkstart;
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user