Merge branch 'develop' into develop_new_dashboard

This commit is contained in:
Laurent Destailleur 2019-08-18 01:26:56 +02:00 committed by GitHub
commit 5351d78a96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
673 changed files with 11204 additions and 3845 deletions

View File

@ -115,12 +115,14 @@ Also, some code changes need a prior approbation:
Once a PR has been submitted, you may need to wait for its integration. It is common that the project leader let the PR open for a long delay to allow every developer discuss about the PR.
If the label of PR start with "WIP" (Work In Progress), it will not be analyzed (until you change the label of PR).
If your PR has errors reported by the Continuous Integration Platform, it means your PR is not valid and nothing will be done with it. It will be kept open to allow developers to fix this, or it may be closed several month later. Don't expect anything on your PR if you have such errors, you MUST first fix the Continuous Integration error to have it taken into consideration.
If the PR is valid, and is kept open for a long time, a tag will also be added on the PR to describe the status of your PR and why the PR is kept open. By putting your mouse on the tag, you will get a full explanation of the tag/status that explain why your PR has not been integrated yet.
In most cases, it give you information of things you have to do to have the PR taken into consideration (for example a change is requested, a conflict is expected to be solved, some questions were asked). If you have a yellow, red flag of purple flag, don't expect to have your PR validated. You must first provide the answer the flag ask you. The majority of PR are waiting a developer action.
In most cases, it gives you information of things you have to do to have the PR taken into consideration (for example a change is requested, a conflict is expected to be solved, some questions were asked). If you have a yellow, red flag of purple flag, don't expect to have your PR validated. You must first provide the answer the flag ask you. The majority of PR are waiting an action of the developer/author.
Around 95% of submitted PR are reviewed and tagged. Even if this is one of the most important ratio of answered PR in Open Source world, don't expect the core team to reach the 100%. With the increasing popularity of Dolibarr, this ratio will probably decrease in future.
Statistics on Dolibarr project shows that around 95% of submitted PR are reviewed and tagged. This is one of the most important ratio of answered PR in Open Source world. Don't expect the core team to reach the 100%. With the increasing popularity of Dolibarr, this ratio will probably decrease in future.
### Resources

109
ChangeLog
View File

@ -15,8 +15,117 @@ WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Properties ->libelle_incoterms were renamed into ->label_incoterms
* Removed the method liste_array() of project class. It was not used by core code.
* The function show_theme() hase been renamed into showSkins()
***** ChangeLog for 10.0.1 compared to 10.0.0 *****
FIX: #10930
FIX: #10984
FIX: reposition on "Build backup" button
FIX: #11400
FIX: #11412
FIX: #11460
FIX: #11463
FIX: #11466
FIX: #11492
FIX: #11498
FIX: #11505
FIX: #11506
FIX: #11507
FIX: #11509
FIX: #11537
FIX: #11543
FIX: #11553
FIX: #11576
FIX: #11584
FIX: #11590
FIX: accounting mode must be taken from global conf, because there's no way to choose a mode with interface
FIX: Add message from public interface
FIX: add missing hook calls
FIX: Add warning when setup is strange
FIX: ajax call for line positioning when CSRFCHECK_WITH_TOKEN is on
FIX: API return 404 sometimes even if API exists
FIX: Attachment was lost when we validate an expense report
FIX: avoid conflict with "$classname" in card.php
FIX: Bad sql request
FIX: better compatibility with multicompany transverse mode
FIX: Better PHP compatibility
FIX: Block to link with tickets
FIX: Can't submit a ticket from public interface
FIX: categories import: prevent mismatch between category type and object type
FIX: Closing ticket from public interface
FIX: Column 'paid' missing in expense report
FIX: compatibility mysql 8. rank is reserved
FIX: Computed field were not calculated into lists.
FIX: Content of email for subscription
FIX: correct error in files with multiple spaces
FIX: CVE-2019-11199
FIX: delete of links between objects
FIX: div not balanced
FIX: do not return formatted prices in json string
FIX: duplicate on the check (TODO field $onetrtd not used ?)
FIX: element name in update_price
FIX: empty product_use_units in product configuration
FIX: expedition card: infinite loop for printObjectLine hook if return > 0
FIX: extrafield loading bug due to assumption that an object is a third party while it may be a contact if MAIN_USE_COMPANY_NAME_OF_CONTACT is set.
FIX: Fatal error on dol_htmloutput_mesg with corrupted array
FIX: Fatal situation if payment removed on expense report. Action
FIX: FEC Format - Missing date_creation in general ledger when you add a new transaction
FIX: FEC Format - Save translation of the journal label in database & nowrap on amount
FIX: floating point precision errors in the triggers of the workflow module
FIX: for #11232
FIX: format of field with type timestamp
FIX: fournrprice log for insert
FIX: help text
FIX: import filter error
FIX: __INFOS__ tag not exists
FIX: issue #9300: install error with PostgreSQL when using custom table prefix
FIX: Language key
FIX: Limit of uploaded files (max_post_size was not used)
FIX: list of balance of leaves
FIX: minor spelling issues
FIX: missing "dropdown-icon" replacement
FIX: Missing field "Conciliated" into bank transaction export
FIX: missing filter by current contact
FIX: missing token
FIX: Missing where on entity
FIX: move sql request in INNER JOIN
FIX: name was able to be in field but went back to new line
FIX: Nowrap on amount
FIX: Online payment
FIX: on shipment delete confirm dialog, a new checkbox allows the user to choose if they want their stock re-incremented after the deletion.
FIX: option EXPORT_LABEL_FOR_SELECT to restore compatibility in export
FIX: Option THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION
FIX: outdated phpdoc
FIX: Permission for BOM menu
FIX: permission to delete a draft purchase order
FIX: phpcs
FIX: Position was lost when we edit the line of template invoice
FIX: product_use_units was set to 0 each time a conf in block other was set
FIX: propal createFrom hook: undefined parameter attached
FIX: Responsive of public interface of ticket
FIX: search by phone pro
FIX: Setup of TakePos was not possible after a clean install
FIX: Show list of events on tickets
FIX: socpeople assigned list in action com list
FIX: SQL problem on donation & nowrap on amount
FIX: stock increase on shipment deletion if STOCK_CALCULATE_ON_SHIPMENT_NEW: is set
FIX: stripe webhook ID constant set
FIX: summary of time spent in preview tab of projects
FIX: the feature to bill time spent was not enabled.
FIX: The new feature to attach document on lines was not correclty
FIX: The proposed new supplier code does not work
FIX: this function can not be private
FIX: tk9877 - PDF rouget requires product.lib.php (otherwise measuring_units_string() is not defined)
FIX: Update the file index table when we validate/rename a ref.
FIX: use rounding to compare the amounts
FIX: We must save code instead of value in database for template invoice modelpdf
FIX: we need to be able to add freeline with qty between 0 & 1 in supplierorder line
FIX: We should remove property comments only for project and task api.
FIX: When saving an action it didn't save the label based on the type of event if the label is empty and the type is customized
FIX: when STOCK_CALCULATE_ON_SHIPMENT_NEW: is set, deleting a "closed" shipment now increases stock as expected
FIX: wrong path sociales/index.php doesnt exist anymore
***** ChangeLog for 10.0.0 compared to 9.0.0 *****
For Users:
NEW: Module "Ticket" is available as a stable module.

13
SECURITY.md Normal file
View File

@ -0,0 +1,13 @@
# Security Policy
## Supported Versions
| Version | Supported |
| -------- | ------------------ |
| <= 8.0.* | :x: |
| >= 9.0.* | :white_check_mark: |
## Reporting a Vulnerability
To report a vulnerability, please send an email to security@dolibarr.org
In most cases, after fixing the security, we make an answer by email to say the issue has been fixed.

View File

@ -458,16 +458,6 @@ variables_order = "GPCS"
; with user data. This makes most sense when coupled with track_vars - in which
; case you can access all of the GPC variables through the $HTTP_*_VARS[],
; variables.
;
; You should do your best to write your scripts so that they do not require
; register_globals to be on; Using form variables as globals can easily lead
; to possible security problems, if the code is not very well thought of.
register_globals = Off
; Whether or not to register the old-style input arrays, HTTP_GET_VARS
; and friends. If you're not using them, it's recommended to turn them off,
; for performance reasons.
register_long_arrays = Off
; This directive tells PHP whether to declare the argv&argc variables (that
; would contain the GET information). If you don't use these variables, you
@ -477,8 +467,7 @@ register_argc_argv = Off
; When enabled, the SERVER and ENV variables are created when they're first
; used (Just In Time) instead of when the script starts. If these variables
; are not used within a script, having this directive on will result in a
; performance gain. The PHP directives register_globals, register_long_arrays,
; and register_argc_argv must be disabled for this directive to have any affect.
; performance gain.
auto_globals_jit = On
; Maximum size of POST data that PHP will accept.
@ -1101,14 +1090,6 @@ session.gc_maxlifetime = 1800
; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
; cd /path/to/sessions; find -cmin +24 | xargs rm
; PHP 4.2 and less have an undocumented feature/bug that allows you to
; to initialize a session variable in the global scope, albeit register_globals
; is disabled. PHP 4.3 and later will warn you, if this feature is used.
; You can disable the feature and the warning separately. At this time,
; the warning is only displayed, if bug_compat_42 is enabled.
session.bug_compat_42 = 0
session.bug_compat_warn = 1
; Check HTTP Referer to invalidate externally stored URLs containing ids.
; HTTP_REFERER has to contain this substring for the session to be

View File

@ -29,16 +29,6 @@ Alias /dolibarr /usr/share/dolibarr/htdocs
ErrorDocument 401 /public/error-401.php
ErrorDocument 404 /public/error-404.php
<IfModule mod_php4.c>
php_flag magic_quotes_gpc Off
php_flag register_globals Off
</IfModule>
<IfModule mod_php5.c>
php_flag magic_quotes_gpc Off
php_flag register_globals Off
</IfModule>
# OPTIMIZE: To use gzip compressed files (for Dolibarr already compressed files).
# Note that constant MAIN_OPTIMIZE_SPEED must have a value with bit 0 set.

View File

@ -658,20 +658,6 @@ html_errors = Off
; Example:
;arg_separator.input = ";&"
; This directive determines which super global arrays are registered when PHP
; starts up. If the register_globals directive is enabled, it also determines
; what order variables are populated into the global space. G,P,C,E & S are
; abbreviations for the following respective super globals: GET, POST, COOKIE,
; ENV and SERVER. There is a performance penalty paid for the registration of
; these arrays and because ENV is not as commonly used as the others, ENV is
; is not recommended on productions servers. You can still get access to
; the environment variables through getenv() should you need to.
; Default Value: "EGPCS"
; Development Value: "GPCS"
; Production Value: "GPCS";
; http://php.net/variables-order
variables_order = "GPCS"
; This directive determines which super global data (G,P,C,E & S) should
; be registered into the super global array REQUEST. If so, it also determines
; the order in which that data is registered. The values for this directive are
@ -685,15 +671,6 @@ variables_order = "GPCS"
; http://php.net/request-order
request_order = "GP"
; Whether or not to register the EGPCS variables as global variables. You may
; want to turn this off if you don't want to clutter your scripts' global scope
; with user data.
; You should do your best to write your scripts so that they do not require
; register_globals to be on; Using form variables as globals can easily lead
; to possible security problems, if the code is not very well thought of.
; http://php.net/register-globals
register_globals = Off
; Determines whether the deprecated long $HTTP_*_VARS type predefined variables
; are registered by PHP or not. As they are deprecated, we obviously don't
; recommend you use them. They are on by default for compatibility reasons but
@ -722,8 +699,7 @@ register_argc_argv = Off
; When enabled, the SERVER and ENV variables are created when they're first
; used (Just In Time) instead of when the script starts. If these variables
; are not used within a script, having this directive on will result in a
; performance gain. The PHP directives register_globals, register_long_arrays,
; and register_argc_argv must be disabled for this directive to have any affect.
; performance gain.
; http://php.net/auto-globals-jit
auto_globals_jit = On
@ -1516,22 +1492,6 @@ session.gc_maxlifetime = 1440
; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
; find /path/to/sessions -cmin +24 | xargs rm
; PHP 4.2 and less have an undocumented feature/bug that allows you to
; to initialize a session variable in the global scope, even when register_globals
; is disabled. PHP 4.3 and later will warn you, if this feature is used.
; You can disable the feature and the warning separately. At this time,
; the warning is only displayed, if bug_compat_42 is enabled. This feature
; introduces some serious security problems if not handled correctly. It's
; recommended that you do not use this feature on production servers. But you
; should enable this on development servers and enable the warning as well. If you
; do not enable the feature on development servers, you won't be warned when it's
; used and debugging errors caused by this can be difficult to track down.
; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/session.bug-compat-42
session.bug_compat_42 = Off
; This setting controls whether or not you are warned by PHP when initializing a
; session value into the global space. session.bug_compat_42 must be enabled before
; these warnings can be issued by PHP. See the directive above for more information.

View File

@ -6,6 +6,7 @@
<exclude-pattern type="relative">build/html</exclude-pattern>
<exclude-pattern type="relative">build/aps</exclude-pattern>
<exclude-pattern type="relative">documents</exclude-pattern>
<exclude-pattern type="relative">htdocs/core/class/lessc.class.php</exclude-pattern>
<exclude-pattern type="relative">htdocs/custom</exclude-pattern>
<exclude-pattern type="relative">htdocs/includes</exclude-pattern>
<exclude-pattern type="relative">htdocs/install/doctemplates/websites</exclude-pattern>

View File

@ -156,17 +156,8 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
$ok=1;
foreach ($listfield as $f => $value)
{
if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancyCategory','Pcg_version'))) continue; // For some pages, country is not mandatory
if ($value == 'country' && in_array($tablib[$id], array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
if ($value == 'color' && empty($_POST['color'])) continue;
if ($value == 'formula' && empty($_POST['formula'])) continue;
if ((! isset($_POST[$value]) || $_POST[$value]=='')
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy')) // Fields that are not mandatory
&& (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
)
)
if ($value == 'country_id' && in_array($tablib[$id], array('Pcg_version'))) continue; // For some pages, country is not mandatory
if ((! isset($_POST[$value]) || $_POST[$value]==''))
{
$ok=0;
$fieldnamekey=$listfield[$f];
@ -174,19 +165,6 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
if ($fieldnamekey == 'pcg_version') $fieldnamekey='Pcg_version';
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
if ($fieldnamekey == 'nbjour') $fieldnamekey='NbOfDays';
if ($fieldnamekey == 'decalage') $fieldnamekey='Offset';
if ($fieldnamekey == 'module') $fieldnamekey='Module';
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
if ($fieldnamekey == 'taux') $fieldnamekey = 'Rate';
if ($fieldnamekey == 'type') $fieldnamekey = 'Type';
if ($fieldnamekey == 'position') $fieldnamekey = 'Position';
if ($fieldnamekey == 'unicode') $fieldnamekey = 'Unicode';
if ($fieldnamekey == 'deductible') $fieldnamekey = 'Deductible';
if ($fieldnamekey == 'sortorder') $fieldnamekey = 'SortOrder';
if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated';
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
}
@ -196,9 +174,9 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
$ok=0;
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
}
if (isset($_POST["code"]))
if (isset($_POST["pcg_version"]))
{
if ($_POST["code"]=='0')
if ($_POST["pcg_version"]=='0')
{
$ok=0;
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
@ -211,28 +189,9 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
}
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
{
if (in_array($tablib[$id], array('DictionaryCompanyType','DictionaryHolidayTypes'))) // Field country is no mandatory for such dictionaries
{
$_POST["country"]='';
}
else
{
$ok=0;
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors');
}
$ok=0;
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors');
}
if (! is_numeric($_POST["code"]))
{
$ok=0;
setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric", $langs->transnoentities("Code")), null, 'errors');
}
// Clean some parameters
if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
// Si verif ok et action add, on ajoute la ligne
if ($ok && GETPOST('actionadd', 'alpha'))

View File

@ -1058,7 +1058,7 @@ if ($id)
$valuetoshow=$langs->trans($valuetoshow); // try to translate
$class='';
if ($fieldlist[$field]=='pos') { $valuetoshow=$langs->trans("Position"); $class='width100'; }
if ($fieldlist[$field]=='pos') { $valuetoshow=$langs->trans("Position"); $class='maxwidth100'; }
if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); }
if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); }
if ($fieldlist[$field]=='taux') {
@ -1076,7 +1076,7 @@ if ($id)
if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") $valuetoshow=$form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
else $valuetoshow=$langs->trans("Type");
}
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); $class='width100'; }
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); $class='maxwidth100'; }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
{
$valuetoshow=$form->textwithtooltip($langs->trans("Label"), $langs->trans("LabelUsedByDefault"), 2, 1, img_help(1, ''));
@ -1602,7 +1602,6 @@ if ($id)
$class='tddict';
if ($fieldlist[$field] == 'note' && $id == 10) $class.=' tdoverflowmax200';
if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto';
if ($fieldlist[$field] == 'code') $class.=' width100';
if ($fieldlist[$field] == 'position') $class.=' right';
if ($fieldlist[$field] == 'localtax1_type') $class.=' nowrap';
if ($fieldlist[$field] == 'localtax2_type') $class.=' nowrap';
@ -1780,7 +1779,6 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
global $form;
global $region_id;
global $elementList,$sourceList,$localtax_typeList;
global $bc;
$formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db);
@ -1981,7 +1979,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
}
$classtd=''; $class='';
if ($fieldlist[$field]=='code') $classtd='width100';
if ($fieldlist[$field]=='code') $class='maxwidth100';
if (in_array($fieldlist[$field], array('pos', 'use_default', 'affect', 'delay', 'position', 'sortorder', 'sens', 'category_type'))) $class='maxwidth50';
if (in_array($fieldlist[$field], array('libelle', 'label', 'tracking'))) $class='quatrevingtpercent';
print '<td class="'.$classtd.'">';

View File

@ -259,7 +259,7 @@ if ($action == 'edit') // Edit
print '</table><br>'."\n";
// Themes and themes options
show_theme(null, 1);
showSkins(null, 1);
print '<br>';
// Other
@ -464,7 +464,7 @@ else // Show
// Themes
show_theme(null, 0);
showSkins(null, 0);
print '<br>';

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -279,6 +280,12 @@ if ($action == 'edit') // Edit
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS', (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS:0, 1);
print '</td></tr>';
//Invert sender and recipient
print '<tr class="oddeven"><td>'.$langs->trans("SwapSenderAndRecipientOnPDF").'</td><td>';
print $form->selectyesno('MAIN_INVERT_SENDER_RECIPIENT', (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT))?$conf->global->MAIN_INVERT_SENDER_RECIPIENT:0, 1);
print '</td></tr>';
// Place customer adress to the ISO location
print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td>';

View File

@ -618,7 +618,7 @@ if ($id)
// Active
print '<td align="center" class="nowrap">';
print '<a href="'.$url.'action='.$acts[$obj->status].'">'.$actl[$obj->status].'</a>';
print '<a href="'.$url.'action='.$acts[($obj->status?1:0)].'">'.$actl[($obj->status?1:0)].'</a>';
print "</td>";
// Modify link

View File

@ -78,6 +78,12 @@ if ($action == 'setproductionmode')
}
}
if ($action == 'save')
{
dolibarr_set_const($db, 'API_RESTICT_ON_IP', GETPOST('API_RESTICT_ON_IP', 'alpha'));
}
dol_mkdir(DOL_DATA_ROOT.'/api/temp'); // May have been deleted by a purge
@ -93,37 +99,50 @@ print load_fiche_titre($langs->trans("ApiSetup"), $linkback, 'title_setup');
print $langs->trans("ApiDesc")."<br>\n";
print "<br>\n";
//print '<form name="apisetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="save">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print "<td>".$langs->trans("Parameter")."</td>";
print '<td align="center">'.$langs->trans("Value")."</td>";
print '<td>'.$langs->trans("Value")."</td>";
print "<td>&nbsp;</td>";
print "</tr>";
print '<tr class="impair">';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ApiProductionMode").'</td>';
$production_mode=(empty($conf->global->API_PRODUCTION_MODE)?false:true);
if ($production_mode)
{
print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&value='.($i+1).'&status=0">';
print '<td><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&value='.($i+1).'&status=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
}
else
{
print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&value='.($i+1).'&status=1">';
print '<td><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&value='.($i+1).'&status=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '<td>&nbsp;</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("RestrictApiToIps").'</td>';
print '<td><input type="text" name="API_RESTICT_ON_IP" value="'.dol_escape_htmltag($conf->global->API_RESTICT_ON_IP).'"></td>';
print '<td>';
print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'"></td>';
print '</td>';
print '</tr>';
print '</table>';
print '<br><br>';
print '</form>';
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file

View File

@ -368,7 +368,7 @@ class Documents extends DolibarrApi
throw new RestException(404, 'Product not found');
}
$upload_dir = $conf->product->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'product');
$upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
}
elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event')
{

View File

@ -206,6 +206,21 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' ||
// Call one APIs or one definition of an API
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && $reg[2] != '/resources.json' && preg_match('/^\/(swagger|resources)\.json\/(.+)$/', $reg[2], $regbis) && $regbis[2] != 'root')))
{
// Restrict API to some IPs
if (! empty($conf->global->API_RESTICT_ON_IP))
{
$allowedip=explode(' ', $conf->global->API_RESTICT_ON_IP);
$ipremote = getUserRemoteIP();
if (! in_array($ipremote, $allowedip))
{
dol_syslog('Remote ip is '.$ipremote.', not into list '.$conf->global->API_RESTICT_ON_IP);
print 'API not allowed from the IP '.$ipremote;
header('HTTP/1.1 503 API not allowed from your IP '.$ipremote);
//print $conf->global->API_RESTICT_ON_IP;
exit(0);
}
}
$module = $reg[1];
if ($module == 'explorer') // If we call page to explore details of a service
{

View File

@ -380,7 +380,6 @@ if (empty($reshook))
}
} else {
$object->ref = GETPOST('ref');
$object->entity = (GETPOSTISSET('entity')?GETPOST('entity', 'int'):$conf->entity);
$object->ref_client = GETPOST('ref_client');
$object->datep = $datep;
$object->date_livraison = $date_delivery;

View File

@ -6,7 +6,7 @@
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2019 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2017 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
@ -530,11 +530,11 @@ class Propal extends CommonObject
$pu_ht_devise = $tabprice[19];
// Rang to use
$rangtouse = $rang;
if ($rangtouse == -1)
$ranktouse = $rang;
if ($ranktouse == -1)
{
$rangmax = $this->line_max($fk_parent_line);
$rangtouse = $rangmax + 1;
$ranktouse = $rangmax + 1;
}
// TODO A virer
@ -568,7 +568,7 @@ class Propal extends CommonObject
$this->line->fk_remise_except=$fk_remise_except;
$this->line->remise_percent=$remise_percent;
$this->line->subprice=$pu_ht;
$this->line->rang=$rangtouse;
$this->line->rang=$ranktouse;
$this->line->info_bits=$info_bits;
$this->line->total_ht=$total_ht;
$this->line->total_tva=$total_tva;
@ -890,7 +890,6 @@ class Propal extends CommonObject
$now=dol_now();
// Clean parameters
if (empty($this->entity)) $this->entity = $conf->entity;
if (empty($this->date)) $this->date=$this->datep;
$this->fin_validite = $this->date + ($this->duree_validite * 24 * 3600);
if (empty($this->availability_id)) $this->availability_id=0;
@ -1000,7 +999,7 @@ class Propal extends CommonObject
$sql.= ", ".($this->fk_project?$this->fk_project:"null");
$sql.= ", ".(int) $this->fk_incoterms;
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
$sql.= ", ".$this->entity;
$sql.= ", ".setEntity($this);
$sql.= ", ".(int) $this->fk_multicurrency;
$sql.= ", '".$this->db->escape($this->multicurrency_code)."'";
$sql.= ", ".(double) $this->multicurrency_tx;
@ -1056,14 +1055,6 @@ class Propal extends CommonObject
}
}
// Add linked object (deprecated, use ->linkedObjectsIds instead)
if (! $error && $this->origin && $this->origin_id)
{
dol_syslog('Deprecated use of linked object, use ->linkedObjectsIds instead', LOG_WARNING);
$ret = $this->add_object_linked();
if (! $ret) dol_print_error($this->db);
}
/*
* Insertion du detail des produits dans la base
* Insert products detail in database
@ -1091,7 +1082,7 @@ class Propal extends CommonObject
$vatrate = $line->tva_tx;
if ($line->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$line->vat_src_code.')';
$result = $this->addline(
$result = $this->addline(
$line->desc,
$line->subprice,
$line->qty,
@ -1138,7 +1129,7 @@ class Propal extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
$sql.= " SET fk_delivery_address = ".$this->fk_delivery_address;
$sql.= " WHERE ref = '".$this->db->escape($this->ref)."'";
$sql.= " AND entity = ".$conf->entity;
$sql.= " AND entity = ".setEntity($this);
$result=$this->db->query($sql);
}

View File

@ -168,6 +168,7 @@ $arrayfields=array(
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1),
'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'p.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
'p.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
);
// Extra fields
@ -269,7 +270,7 @@ $sql.= " typent.code as typent_code,";
$sql.= " ava.rowid as availability,";
$sql.= " state.code_departement as state_code, state.nom as state_name,";
$sql.= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,';
$sql.= ' p.datec as date_creation, p.tms as date_update,';
$sql.= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
$sql.= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
$sql.= ' u.login';
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user";
@ -688,6 +689,12 @@ if ($resql)
print '<td class="liste_titre">';
print '</td>';
}
// Date cloture
if (! empty($arrayfields['p.date_cloture']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Status
if (! empty($arrayfields['p.fk_statut']['checked']))
{
@ -735,6 +742,7 @@ if ($resql)
print $hookmanager->resPrint;
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
if (! empty($arrayfields['p.date_cloture']['checked'])) print_liste_field_titre($arrayfields['p.date_cloture']['label'], $_SERVER["PHP_SELF"], "p.date_cloture", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
print '</tr>'."\n";
@ -1054,7 +1062,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
@ -1073,6 +1081,14 @@ if ($resql)
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date cloture
if (! empty($arrayfields['p.date_cloture']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_cloture), 'dayhour', 'tzuser');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Status
if (! empty($arrayfields['p.fk_statut']['checked']))
{

View File

@ -96,9 +96,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('ordercard','globalcard'));
$permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->commande->creer; // Used by the include of actions_dellink.inc.php
$permissionedit = $user->rights->commande->creer; // Used by the include of actions_lineupdown.inc.php
$usercanread = $user->rights->commande->lire;
$usercancreate = $user->rights->commande->creer;
$usercanclose = $user->rights->commande->cloturer;
$usercandelete = $user->rights->commande->supprimer;
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)));
$usercancancel = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler)));
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send);
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
$permissionedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php
/*
@ -129,7 +137,7 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->creer)
if ($action == 'confirm_clone' && $confirm == 'yes' && $usercancreate)
{
if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
{
@ -159,7 +167,7 @@ if (empty($reshook))
}
// Reopen a closed order
elseif ($action == 'reopen' && $user->rights->commande->creer)
elseif ($action == 'reopen' && $usercancreate)
{
if ($object->statut == Commande::STATUS_CANCELED || $object->statut == Commande::STATUS_CLOSED)
{
@ -176,7 +184,7 @@ if (empty($reshook))
}
// Remove order
elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->commande->supprimer)
elseif ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete)
{
$result = $object->delete($user);
if ($result > 0)
@ -191,7 +199,7 @@ if (empty($reshook))
}
// Remove a product line
elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->commande->creer)
elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate)
{
$result = $object->deleteline($user, $lineid);
if ($result > 0)
@ -222,13 +230,13 @@ if (empty($reshook))
}
// Link to a project
elseif ($action == 'classin' && $user->rights->commande->creer)
elseif ($action == 'classin' && $usercancreate)
{
$object->setProject(GETPOST('projectid', 'int'));
}
// Add order
elseif ($action == 'add' && $user->rights->commande->creer)
elseif ($action == 'add' && $usercancreate)
{
$datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
@ -481,7 +489,7 @@ if (empty($reshook))
}
}
elseif ($action == 'classifybilled' && $user->rights->commande->creer)
elseif ($action == 'classifybilled' && $usercancreate)
{
$ret=$object->classifyBilled($user);
@ -489,7 +497,7 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors');
}
}
elseif ($action == 'classifyunbilled' && $user->rights->commande->creer)
elseif ($action == 'classifyunbilled' && $usercancreate)
{
$ret=$object->classifyUnBilled();
if ($ret < 0) {
@ -498,7 +506,7 @@ if (empty($reshook))
}
// Positionne ref commande client
elseif ($action == 'setref_client' && $user->rights->commande->creer) {
elseif ($action == 'setref_client' && $usercancreate) {
$result = $object->set_ref_client($user, GETPOST('ref_client'));
if ($result < 0)
{
@ -506,7 +514,7 @@ if (empty($reshook))
}
}
elseif ($action == 'setremise' && $user->rights->commande->creer) {
elseif ($action == 'setremise' && $usercancreate) {
$result = $object->set_remise($user, GETPOST('remise'));
if ($result < 0)
{
@ -514,7 +522,7 @@ if (empty($reshook))
}
}
elseif ($action == 'setabsolutediscount' && $user->rights->commande->creer) {
elseif ($action == 'setabsolutediscount' && $usercancreate) {
if (GETPOST('remise_id')) {
if ($object->id > 0) {
$object->insert_discount(GETPOST('remise_id'));
@ -524,7 +532,7 @@ if (empty($reshook))
}
}
elseif ($action == 'setdate' && $user->rights->commande->creer) {
elseif ($action == 'setdate' && $usercancreate) {
// print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
$date = dol_mktime(0, 0, 0, GETPOST('order_month'), GETPOST('order_day'), GETPOST('order_year'));
@ -534,7 +542,7 @@ if (empty($reshook))
}
}
elseif ($action == 'setdate_livraison' && $user->rights->commande->creer) {
elseif ($action == 'setdate_livraison' && $usercancreate) {
// print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
$datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
@ -544,35 +552,35 @@ if (empty($reshook))
}
}
elseif ($action == 'setmode' && $user->rights->commande->creer) {
elseif ($action == 'setmode' && $usercancreate) {
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
// Multicurrency Code
elseif ($action == 'setmulticurrencycode' && $user->rights->commande->creer) {
elseif ($action == 'setmulticurrencycode' && $usercancreate) {
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
}
// Multicurrency rate
elseif ($action == 'setmulticurrencyrate' && $user->rights->commande->creer) {
elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
}
elseif ($action == 'setavailability' && $user->rights->commande->creer) {
elseif ($action == 'setavailability' && $usercancreate) {
$result = $object->availability(GETPOST('availability_id'));
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
elseif ($action == 'setdemandreason' && $user->rights->commande->creer) {
elseif ($action == 'setdemandreason' && $usercancreate) {
$result = $object->demand_reason(GETPOST('demand_reason_id'));
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
elseif ($action == 'setconditions' && $user->rights->commande->creer) {
elseif ($action == 'setconditions' && $usercancreate) {
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
if ($result < 0) {
dol_print_error($db, $object->error);
@ -604,7 +612,7 @@ if (empty($reshook))
}
// bank account
elseif ($action == 'setbankaccount' && $user->rights->commande->creer) {
elseif ($action == 'setbankaccount' && $usercancreate) {
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
@ -612,7 +620,7 @@ if (empty($reshook))
}
// shipping method
elseif ($action == 'setshippingmethod' && $user->rights->commande->creer) {
elseif ($action == 'setshippingmethod' && $usercancreate) {
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
@ -620,23 +628,23 @@ if (empty($reshook))
}
// warehouse
elseif ($action == 'setwarehouse' && $user->rights->commande->creer) {
elseif ($action == 'setwarehouse' && $usercancreate) {
$result = $object->setWarehouse(GETPOST('warehouse_id', 'int'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
elseif ($action == 'setremisepercent' && $user->rights->commande->creer) {
elseif ($action == 'setremisepercent' && $usercancreate) {
$result = $object->set_remise($user, GETPOST('remise_percent'));
}
elseif ($action == 'setremiseabsolue' && $user->rights->commande->creer) {
elseif ($action == 'setremiseabsolue' && $usercancreate) {
$result = $object->set_remise_absolue($user, GETPOST('remise_absolue'));
}
// Add a new line
elseif ($action == 'addline' && $user->rights->commande->creer)
elseif ($action == 'addline' && $usercancreate)
{
$langs->load('errors');
$error = 0;
@ -999,7 +1007,7 @@ if (empty($reshook))
/*
* Update a line
*/
elseif ($action == 'updateline' && $user->rights->commande->creer && GETPOST('save'))
elseif ($action == 'updateline' && $usercancreate && GETPOST('save'))
{
// Clean parameters
$date_start='';
@ -1133,15 +1141,12 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors');
}
}
} elseif ($action == 'updateline' && $user->rights->commande->creer && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) {
} elseif ($action == 'updateline' && $usercancreate && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
exit();
}
elseif ($action == 'confirm_validate' && $confirm == 'yes' &&
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
)
elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate)
{
$idwarehouse = GETPOST('idwarehouse');
@ -1195,7 +1200,7 @@ if (empty($reshook))
}
// Go back to draft status
elseif ($action == 'confirm_modif' && $user->rights->commande->creer) {
elseif ($action == 'confirm_modif' && $usercancreate) {
$idwarehouse = GETPOST('idwarehouse');
$qualified_for_stock_change=0;
@ -1243,17 +1248,14 @@ if (empty($reshook))
}
}
elseif ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer) {
elseif ($action == 'confirm_shipped' && $confirm == 'yes' && $usercanclose) {
$result = $object->cloture($user);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
elseif ($action == 'confirm_cancel' && $confirm == 'yes' &&
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
)
elseif ($action == 'confirm_cancel' && $confirm == 'yes' && $usercanvalidate)
{
$idwarehouse = GETPOST('idwarehouse');
@ -1310,7 +1312,7 @@ if (empty($reshook))
if ($error) $action = 'edit_extras';
}
if ($action == 'set_thirdparty' && $user->rights->commande->creer)
if ($action == 'set_thirdparty' && $usercancreate)
{
$object->fetch($id);
$object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY');
@ -1321,7 +1323,7 @@ if (empty($reshook))
// add lines from objectlinked
if($action == 'import_lines_from_object'
&& $user->rights->commande->creer
&& $usercancreate
&& $object->statut == Commande::STATUS_DRAFT
)
{
@ -1405,8 +1407,8 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Actions to build doc
$upload_dir = $conf->commande->dir_output;
$permissioncreate = $user->rights->commande->creer;
$upload_dir = $conf->commande->multidir_output[$object->entity];
$permissioncreate = $usercancreate;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
// Actions to send emails
@ -1417,7 +1419,7 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer)
if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $usercancreate)
{
if ($action == 'addcontact')
{
@ -1478,7 +1480,7 @@ $formmargin = new FormMargin($db);
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
// Mode creation
if ($action == 'create' && $user->rights->commande->creer)
if ($action == 'create' && $usercancreate)
{
print load_fiche_titre($langs->trans('CreateOrder'), '', 'title_commercial.png');
@ -2069,8 +2071,8 @@ if ($action == 'create' && $user->rights->commande->creer)
$morehtmlref='<div class="refidno">';
// Ref customer
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1);
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherOrders").'</a>)';
@ -2079,7 +2081,7 @@ if ($action == 'create' && $user->rights->commande->creer)
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->commande->creer)
if ($usercancreate)
{
if ($action != 'classify')
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
@ -2159,7 +2161,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Date
print '<tr><td>';
$editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT;
$editenable = $usercancreate && $object->statut == Commande::STATUS_DRAFT;
print $form->editfieldkey("Date", 'date', '', $object, $editenable);
print '</td><td>';
if ($action == 'editdate') {
@ -2180,7 +2182,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Delivery date planed
print '<tr><td>';
$editenable = $user->rights->commande->creer;
$editenable = $usercancreate;
print $form->editfieldkey("DateDeliveryPlanned", 'date_livraison', '', $object, $editenable);
print '</td><td>';
if ($action == 'editdate_livraison') {
@ -2202,7 +2204,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Shipping Method
if (! empty($conf->expedition->enabled)) {
print '<tr><td>';
$editenable = $user->rights->commande->creer;
$editenable = $usercancreate;
print $form->editfieldkey("SendingMethod", 'shippingmethod', '', $object, $editenable);
print '</td><td>';
if ($action == 'editshippingmethod') {
@ -2220,7 +2222,7 @@ if ($action == 'create' && $user->rights->commande->creer)
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct=new FormProduct($db);
print '<tr><td>';
$editenable = $user->rights->commande->creer;
$editenable = $usercancreate;
print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $editenable);
print '</td><td>';
if ($action == 'editwarehouse') {
@ -2234,7 +2236,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Terms of payment
print '<tr><td>';
$editenable = $user->rights->commande->creer;
$editenable = $usercancreate;
print $form->editfieldkey("PaymentConditionsShort", 'conditions', '', $object, $editenable);
print '</td><td>';
if ($action == 'editconditions') {
@ -2248,7 +2250,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Mode of payment
print '<tr><td>';
$editenable = $user->rights->commande->creer;
$editenable = $usercancreate;
print $form->editfieldkey("PaymentMode", 'mode', '', $object, $editenable);
print '</td><td>';
if ($action == 'editmode') {
@ -2264,7 +2266,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Multicurrency code
print '<tr>';
print '<td>';
$editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT;
$editenable = $usercancreate && $object->statut == Commande::STATUS_DRAFT;
print $form->editfieldkey("Currency", 'multicurrencycode', '', $object, $editenable);
print '</td><td>';
if ($action == 'editmulticurrencycode') {
@ -2277,7 +2279,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Multicurrency rate
print '<tr>';
print '<td>';
$editenable = $user->rights->commande->creer && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $object->statut == Commande::STATUS_DRAFT;
$editenable = $usercancreate && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $object->statut == Commande::STATUS_DRAFT;
print $form->editfieldkey("CurrencyRate", 'multicurrencyrate', '', $object, $editenable);
print '</td><td>';
if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
@ -2298,7 +2300,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Delivery delay
print '<tr class="fielddeliverydelay"><td>';
$editenable = $user->rights->commande->creer;
$editenable = $usercancreate;
print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, $editenable);
print '</td><td>';
if ($action == 'editavailability') {
@ -2310,7 +2312,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Source reason (why we have an ordrer)
print '<tr><td>';
$editenable = $user->rights->commande->creer;
$editenable = $usercancreate;
print $form->editfieldkey("Channel", 'demandreason', '', $object, $editenable);
print '</td><td>';
if ($action == 'editdemandreason') {
@ -2323,7 +2325,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// TODO Order mode (how we receive order). Not yet implemented
/*
print '<tr><td>';
$editenable = $user->rights->commande->creer;
$editenable = $usercancreate;
print $form->editfieldkey("SourceMode", 'inputmode', '', $object, $editenable);
print '</td><td>';
if ($action == 'editinputmode') {
@ -2355,7 +2357,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Incoterms
if (!empty($conf->incoterm->enabled)) {
print '<tr><td>';
$editenable = $user->rights->commande->creer;
$editenable = $usercancreate;
print $form->editfieldkey("IncotermLabel", 'incoterm', '', $object, $editenable);
print '</td>';
print '<td>';
@ -2373,7 +2375,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Bank Account
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) {
print '<tr><td>';
$editenable = $user->rights->commande->creer;
$editenable = $usercancreate;
print $form->editfieldkey("BankAccount", 'bankaccount', '', $object, $editenable);
print '</td><td>';
if ($action == 'editbankaccount') {
@ -2497,7 +2499,7 @@ if ($action == 'create' && $user->rights->commande->creer)
/*
* Form to add new line
*/
if ($object->statut == Commande::STATUS_DRAFT && $user->rights->commande->creer && $action != 'selectlines')
if ($object->statut == Commande::STATUS_DRAFT && $usercancreate && $action != 'selectlines')
{
if ($action != 'editline')
{
@ -2528,22 +2530,19 @@ if ($action == 'create' && $user->rights->commande->creer)
if (empty($reshook)) {
// Send
if ($object->statut > Commande::STATUS_DRAFT) {
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send)) {
if ($usercansend) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a></div>';
} else
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans('SendMail') . '</a></div>';
}
// Valid
if ($object->statut == Commande::STATUS_DRAFT && $object->total_ttc >= 0 && $numlines > 0 &&
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
)
if ($object->statut == Commande::STATUS_DRAFT && $object->total_ttc >= 0 && $numlines > 0 && $usercanvalidate)
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=validate">' . $langs->trans('Validate') . '</a></div>';
}
// Edit
if ($object->statut == Commande::STATUS_VALIDATED && $user->rights->commande->creer) {
if ($object->statut == Commande::STATUS_VALIDATED && $usercancreate) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id=' . $object->id . '&amp;action=modif">' . $langs->trans('Modify') . '</a></div>';
}
// Create event
@ -2597,12 +2596,12 @@ if ($action == 'create' && $user->rights->commande->creer)
}
// Reopen a closed order
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $user->rights->commande->creer) {
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&amp;action=reopen">' . $langs->trans('ReOpen') . '</a></div>';
}
// Set to shipped
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $user->rights->commande->cloturer) {
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=shipped">' . $langs->trans('ClassifyShipped') . '</a></div>';
}
@ -2612,31 +2611,28 @@ if ($action == 'create' && $user->rights->commande->creer)
if (! empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/compta/facture/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("CreateBill") . '</a></div>';
}
if ($user->rights->commande->creer && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=classifybilled">' . $langs->trans("ClassifyBilled") . '</a></div>';
}
}
if ($object->statut > Commande::STATUS_DRAFT && $object->billed) {
if ($user->rights->commande->creer && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=classifyunbilled">' . $langs->trans("ClassifyUnBilled") . '</a></div>';
}
}
// Clone
if ($user->rights->commande->creer) {
if ($usercancreate) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&amp;socid=' . $object->socid . '&amp;action=clone&amp;object=order">' . $langs->trans("ToClone") . '</a></div>';
}
// Cancel order
if ($object->statut == Commande::STATUS_VALIDATED &&
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->cloturer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler)))
)
if ($object->statut == Commande::STATUS_VALIDATED && (! empty($usercanclose) || ! empty($usercancancel)))
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=cancel">' . $langs->trans('Cancel') . '</a></div>';
}
// Delete order
if ($user->rights->commande->supprimer) {
if ($usercandelete) {
if ($numshipping == 0) {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=delete">' . $langs->trans('Delete') . '</a></div>';
} else {
@ -2659,18 +2655,18 @@ if ($action == 'create' && $user->rights->commande->creer)
// Documents
$comref = dol_sanitizeFileName($object->ref);
$relativepath = $comref . '/' . $comref . '.pdf';
$filedir = $conf->commande->dir_output . '/' . $comref;
$filedir = $conf->commande->multidir_output[$object->entity] . '/' . $comref;
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
$genallowed = $user->rights->commande->lire;
$delallowed = $user->rights->commande->creer;
print $formfile->showdocuments('commande', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
$genallowed = $usercanread;
$delallowed = $usercancreate;
print $formfile->showdocuments('commande', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang, '', $object);
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('order'));
$compatibleImportElementsList = false;
if($user->rights->commande->creer
if($usercancreate
&& $object->statut == Commande::STATUS_DRAFT)
{
$compatibleImportElementsList = array('commande','propal'); // import from linked elements
@ -2707,7 +2703,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Presend form
$modelmail='order_send';
$defaulttopic='SendOrderRef';
$diroutput = $conf->commande->dir_output;
$diroutput = $conf->commande->multidir_output[$object->entity];
$trackid = 'ord'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';

View File

@ -433,8 +433,8 @@ class Commande extends CommonOrder
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
$oldref = dol_sanitizeFileName($this->ref);
$newref = dol_sanitizeFileName($num);
$dirsource = $conf->commande->dir_output.'/'.$oldref;
$dirdest = $conf->commande->dir_output.'/'.$newref;
$dirsource = $conf->commande->multidir_output[$this->entity].'/'.$oldref;
$dirdest = $conf->commande->multidir_output[$this->entity].'/'.$newref;
if (! $error && file_exists($dirsource))
{
dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest);
@ -443,7 +443,7 @@ class Commande extends CommonOrder
{
dol_syslog("Rename ok");
// Rename docs starting with $oldref with $newref
$listoffiles=dol_dir_list($conf->commande->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
$listoffiles=dol_dir_list($conf->commande->multidir_output[$this->entity].'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
foreach($listoffiles as $fileentry)
{
$dirsource=$fileentry['name'];
@ -865,7 +865,7 @@ class Commande extends CommonOrder
$sql.= ", ".($this->remise_percent>0?$this->db->escape($this->remise_percent):0);
$sql.= ", ".(int) $this->fk_incoterms;
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
$sql.= ", ".$conf->entity;
$sql.= ", ".setEntity($this);
$sql.= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null");
$sql.= ", ".($this->pos_source != '' ? "'".$this->db->escape($this->pos_source)."'" : "null");
$sql.= ", ".(int) $this->fk_multicurrency;
@ -1238,6 +1238,7 @@ class Commande extends CommonOrder
$this->lines[$i] = $line;
}
$this->entity = $object->entity;
$this->socid = $object->socid;
$this->fk_project = $object->fk_project;
$this->cond_reglement_id = $object->cond_reglement_id;
@ -1457,11 +1458,11 @@ class Commande extends CommonOrder
$pu_ht_devise = $tabprice[19];
// Rang to use
$rangtouse = $rang;
if ($rangtouse == -1)
$ranktouse = $rang;
if ($ranktouse == -1)
{
$rangmax = $this->line_max($fk_parent_line);
$rangtouse = $rangmax + 1;
$ranktouse = $rangmax + 1;
}
// TODO A virer
@ -1495,7 +1496,7 @@ class Commande extends CommonOrder
$this->line->fk_remise_except=$fk_remise_except;
$this->line->remise_percent=$remise_percent;
$this->line->subprice=$pu_ht;
$this->line->rang=$rangtouse;
$this->line->rang=$ranktouse;
$this->line->info_bits=$info_bits;
$this->line->total_ht=$total_ht;
$this->line->total_tva=$total_tva;
@ -3335,10 +3336,10 @@ class Commande extends CommonOrder
{
// Remove directory with files
$comref = dol_sanitizeFileName($this->ref);
if ($conf->commande->dir_output && !empty($this->ref))
if ($conf->commande->multidir_output[$this->entity] && !empty($this->ref))
{
$dir = $conf->commande->dir_output . "/" . $comref ;
$file = $conf->commande->dir_output . "/" . $comref . "/" . $comref . ".pdf";
$dir = $conf->commande->multidir_output[$this->entity] . "/" . $comref ;
$file = $conf->commande->multidir_output[$this->entity] . "/" . $comref . "/" . $comref . ".pdf";
if (file_exists($file)) // We must delete all files before deleting directory
{
dol_delete_preview($this);

View File

@ -72,7 +72,7 @@ $object = new Commande($db);
if ($object->fetch($id))
{
$object->fetch_thirdparty();
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
$upload_dir = $conf->commande->multidir_output[$object->entity] . "/" . dol_sanitizeFileName($object->ref);
}
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
@ -92,7 +92,7 @@ if ($id > 0 || ! empty($ref))
{
$object->fetch_thirdparty();
$upload_dir = $conf->commande->dir_output.'/'.dol_sanitizeFileName($object->ref);
$upload_dir = $conf->commande->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
$head = commande_prepare_head($object);
dol_fiche_head($head, 'documents', $langs->trans('CustomerOrder'), -1, 'order');
@ -174,7 +174,7 @@ if ($id > 0 || ! empty($ref))
$modulepart = 'commande';
$permission = $user->rights->commande->creer;
$permtoedit = $user->rights->commande->creer;
$param = '&id=' . $object->id;
$param = '&id=' . $object->id.'&entity=' . (! empty($object->entity)?$object->entity:$conf->entity);
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
}
else

View File

@ -241,7 +241,7 @@ $max=5;
* Last modified orders
*/
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, c.date_cloture as datec, c.tms as datem,";
$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_cloture as datec, c.tms as datem,";
$sql.= " s.nom as name, s.rowid as socid";
$sql.= ", s.client";
$sql.= ", s.code_client";
@ -297,7 +297,7 @@ if ($resql)
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir);
print '</td></tr></table>';
@ -323,7 +323,7 @@ else dol_print_error($db);
*/
if (! empty($conf->commande->enabled))
{
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid";
$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid";
$sql.= ", s.client";
$sql.= ", s.code_client";
$sql.= ", s.canvas";
@ -377,7 +377,7 @@ if (! empty($conf->commande->enabled))
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir);
print '</td></tr></table>';
@ -405,7 +405,7 @@ if (! empty($conf->commande->enabled))
*/
if (! empty($conf->commande->enabled))
{
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid";
$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid";
$sql.= ", s.client";
$sql.= ", s.code_client";
$sql.= ", s.canvas";
@ -459,7 +459,7 @@ if (! empty($conf->commande->enabled))
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir);
print '</td></tr></table>';

View File

@ -91,7 +91,7 @@ $id = (GETPOST('orderid')?GETPOST('orderid', 'int'):GETPOST('id', 'int'));
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'commande', $id, '');
$diroutputmassaction=$conf->commande->dir_output . '/temp/massgeneration/'.$user->id;
$diroutputmassaction=$conf->commande->multidir_output[$conf->entity] . '/temp/massgeneration/'.$user->id;
// Load variable for pagination
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
@ -143,6 +143,7 @@ $arrayfields=array(
'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
'c.facture'=>array('label'=>"Billed", 'checked'=>1, 'position'=>1000, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)))
);
@ -217,7 +218,7 @@ if (empty($reshook))
$objectlabel='Orders';
$permtoread = $user->rights->commande->lire;
$permtodelete = $user->rights->commande->supprimer;
$uploaddir = $conf->commande->dir_output;
$uploaddir = $conf->commande->multidir_output[$conf->entity];
$trigger_name='ORDER_SENTBYMAIL';
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@ -247,7 +248,7 @@ $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,';
$sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
$sql.= ' c.date_creation as date_creation, c.tms as date_update,';
$sql.= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
$sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields
@ -693,6 +694,12 @@ if ($resql)
print '<td class="liste_titre">';
print '</td>';
}
// Date cloture
if (! empty($arrayfields['c.date_cloture']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Status
if (! empty($arrayfields['c.fk_statut']['checked']))
{
@ -748,7 +755,8 @@ if ($resql)
print $hookmanager->resPrint;
if (! empty($arrayfields['c.datec']['checked'])) print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'], $_SERVER["PHP_SELF"], "c.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['c.date_cloture']['checked'])) print_liste_field_titre($arrayfields['c.date_cloture']['label'], $_SERVER["PHP_SELF"], "c.date_cloture", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['c.facture']['checked'])) print_liste_field_titre($arrayfields['c.facture']['label'], $_SERVER["PHP_SELF"], 'c.facture', '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center ');
print '</tr>'."\n";
@ -926,7 +934,7 @@ if ($resql)
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->multidir_output[$conf->entity] . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
print '</td>';
@ -1073,7 +1081,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
@ -1092,6 +1100,14 @@ if ($resql)
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date cloture
if (! empty($arrayfields['c.date_cloture']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_cloture), 'dayhour', 'tzuser');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Status
if (! empty($arrayfields['c.fk_statut']['checked']))
{

View File

@ -548,7 +548,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
</script>
<?php
$sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
$sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.entity, c.ref, c.total_ht, c.ref_client,';
$sql.= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as billed';
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql.= ', '.MAIN_DB_PREFIX.'commande as c';
@ -682,7 +682,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
$filename=dol_sanitizeFileName($objp->ref);
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref);
$filedir=$conf->commande->multidir_output[$objp->entity] . '/' . dol_sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid;
print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
print '</td></tr></table>';

View File

@ -23,6 +23,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
/**
* API class for accounts
*
* @property DoliDB db
* @access protected
* @class DolibarrApiAccess {@requires user,external}
*/
@ -166,6 +167,142 @@ class BankAccounts extends DolibarrApi
return $account->id;
}
/**
* Create an internal wire transfer between two bank accounts
*
* @param int $bankaccount_from_id BankAccount ID to use as the source of the internal wire transfer {@from body}{@required true}
* @param int $bankaccount_to_id BankAccount ID to use as the destination of the internal wire transfer {@from body}{@required true}
* @param string $date Date of the internal wire transfer (UNIX timestamp) {@from body}{@required true}{@type timestamp}
* @param string $description Description of the internal wire transfer {@from body}{@required true}
* @param float $amount Amount to transfer from the source to the destination BankAccount {@from body}{@required true}
* @param float $amount_to Amount to transfer to the destination BankAccount (only when accounts does not share the same currency) {@from body}{@required false}
*
* @url POST /transfer
*
* @return array
*
* @status 201
*
* @throws 401 Unauthorized: User does not have permission to configure bank accounts
* @throws 404 Not Found: Either the source or the destination bankaccount for the provided id does not exist
* @throws 422 Unprocessable Entity: Refer to detailed exception message for the cause
* @throws 500 Internal Server Error: Error(s) returned by the RDBMS
*/
public function transfer($bankaccount_from_id = 0, $bankaccount_to_id = 0, $date = null, $description = "", $amount = 0.0, $amount_to = 0.0)
{
if (! DolibarrApiAccess::$user->rights->banque->configurer) {
throw new RestException(401);
}
if ($bankaccount_from_id === $bankaccount_to_id) {
throw new RestException(422, 'bankaccount_from_id and bankaccount_to_id must be different !');
}
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$accountfrom = new Account($this->db);
$resultAccountFrom = $accountfrom->fetch($bankaccount_from_id);
if ($resultAccountFrom === 0) {
throw new RestException(404, 'The BankAccount for bankaccount_from_id provided does not exist.');
}
$accountto = new Account($this->db);
$resultAccountTo = $accountto->fetch($bankaccount_to_id);
if ($resultAccountTo === 0) {
throw new RestException(404, 'The BankAccount for bankaccount_to_id provided does not exist.');
}
if ($accountto->currency_code == $accountfrom->currency_code)
{
$amount_to = $amount;
}
else
{
if (!$amount_to || empty($amount_to))
{
throw new RestException(422, 'You must provide amount_to value since bankaccount_from and bankaccount_to does not share the same currency.');
}
}
$this->db->begin();
$error = 0;
$bank_line_id_from = 0;
$bank_line_id_to = 0;
$result = 0;
$user = DolibarrApiAccess::$user;
// By default, electronic transfert from bank to bank
$typefrom='PRE';
$typeto='VIR';
if ($accountto->courant == Account::TYPE_CASH || $accountfrom->courant == Account::TYPE_CASH)
{
// This is transfer of change
$typefrom='LIQ';
$typeto='LIQ';
}
/**
* Creating bank line records
*/
if (!$error) {
$bank_line_id_from = $accountfrom->addline($date, $typefrom, $description, -1*price2num($amount), '', '', $user);
}
if (!($bank_line_id_from > 0)) {
$error++;
}
if (!$error) {
$bank_line_id_to = $accountto->addline($date, $typeto, $description, price2num($amount_to), '', '', $user);
}
if (!($bank_line_id_to > 0)) {
$error++;
}
/**
* Creating links between bank line record and its source
*/
$url = DOL_URL_ROOT.'/compta/bank/line.php?rowid=';
$label = '(banktransfert)';
$type = 'banktransfert';
if (!$error) {
$result = $accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, $url, $label, $type);
}
if (!($result > 0)) {
$error++;
}
if (!$error) {
$result = $accountto->add_url_line($bank_line_id_to, $bank_line_id_from, $url, $label, $type);
}
if (!($result > 0)) {
$error++;
}
if (!$error)
{
$this->db->commit();
return array(
'success' => array(
'code' => 201,
'message' => 'Internal wire transfer created successfully.'
)
);
}
else
{
$this->db->rollback();
throw new RestException(500, $accountfrom->error.' '.$accountto->error);
}
}
/**
* Update account
*

View File

@ -0,0 +1 @@

View File

@ -267,9 +267,9 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$parameters = array('obj' => $obj);
$reshook = $hookmanager->executeHooks('moreFamily', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if(empty($reshook)){
$ref = isset($hookmanager->resArray['ref']) ? $hookmanager->resArray['ref'] : '';
$refcomp = isset($hookmanager->resArray['refcomp']) ? $hookmanager->resArray['refcomp'] : '';
$paiement = isset($hookmanager->resArray['paiement']) ? $hookmanager->resArray['paiement'] : 0;
$ref = isset($hookmanager->resArray['ref']) ? $hookmanager->resArray['ref'] : $ref;
$refcomp = isset($hookmanager->resArray['refcomp']) ? $hookmanager->resArray['refcomp'] : $refcomp;
$paiement = isset($hookmanager->resArray['paiement']) ? $hookmanager->resArray['paiement'] : $paiement;
}
$total_ttc = $obj->total_ttc;

View File

@ -945,7 +945,6 @@ if (empty($reshook))
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
$object->entity = (GETPOSTISSET('entity')?GETPOST('entity', 'int'):$conf->entity);
// Proprietes particulieres a facture de remplacement
$object->fk_facture_source = $_POST['fac_replacement'];
@ -979,7 +978,7 @@ if (empty($reshook))
if (! $error)
{
if(!empty($originentity)){
if (!empty($originentity)) {
$object->entity = $originentity;
}
$object->socid = GETPOST('socid', 'int');
@ -1001,7 +1000,6 @@ if (empty($reshook))
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
$object->entity = (GETPOSTISSET('entity')?GETPOST('entity', 'int'):$conf->entity);
// Proprietes particulieres a facture avoir
$object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : '';
@ -1183,7 +1181,6 @@ if (empty($reshook))
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
$object->entity = (GETPOSTISSET('entity')?GETPOST('entity', 'int'):$conf->entity);
// Source facture
$object->fac_rec = GETPOST('fac_rec', 'int');
@ -1234,7 +1231,6 @@ if (empty($reshook))
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
$object->entity = (GETPOSTISSET('entity')?GETPOST('entity', 'int'):$conf->entity);
if (GETPOST('type') == Facture::TYPE_SITUATION)
{
@ -2491,7 +2487,7 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
// Actions to build doc
$upload_dir = $conf->facture->dir_output;
$upload_dir = $conf->facture->multidir_output[$object->entity];
$permissioncreate=$usercancreate;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
@ -5136,12 +5132,12 @@ elseif ($id > 0 || ! empty($ref))
// Documents generes
$filename = dol_sanitizeFileName($object->ref);
$filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref);
$filedir = $conf->facture->multidir_output[$object->entity] . '/' . dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id;
$genallowed = $usercanread;
$delallowed = $usercancreate;
print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang, '', $object);
$somethingshown = $formfile->numoffiles;
// Show links to link elements
@ -5188,7 +5184,7 @@ elseif ($id > 0 || ! empty($ref))
// Presend form
$modelmail='facture_send';
$defaulttopic='SendBillRef';
$diroutput = $conf->facture->dir_output;
$diroutput = $conf->facture->multidir_output[$object->entity];
$trackid = 'inv'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';

View File

@ -318,7 +318,6 @@ class Facture extends CommonInvoice
if (! $this->cond_reglement_id) $this->cond_reglement_id = 0;
if (! $this->mode_reglement_id) $this->mode_reglement_id = 0;
$this->brouillon = 1;
if (empty($this->entity)) $this->entity = $conf->entity;
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
@ -493,7 +492,7 @@ class Facture extends CommonInvoice
$sql.= ")";
$sql.= " VALUES (";
$sql.= "'(PROV)'";
$sql.= ", ".$this->entity;
$sql.= ", ".setEntity($this);
$sql.= ", ".($this->ref_ext?"'".$this->db->escape($this->ref_ext)."'":"null");
$sql.= ", '".$this->db->escape($this->type)."'";
$sql.= ", '".$socid."'";
@ -936,8 +935,8 @@ class Facture extends CommonInvoice
$facture->remise_absolue = $this->remise_absolue;
$facture->remise_percent = $this->remise_percent;
$facture->origin = $this->origin;
$facture->origin_id = $this->origin_id;
$facture->origin = $this->origin;
$facture->origin_id = $this->origin_id;
$facture->lines = $this->lines; // Array of lines of invoice
$facture->products = $this->lines; // Tant que products encore utilise
@ -1624,7 +1623,11 @@ class Facture extends CommonInvoice
$this->tab_previous_situation_invoice = array();
$this->tab_next_situation_invoice = array();
$sql = 'SELECT rowid, situation_counter FROM '.MAIN_DB_PREFIX.'facture WHERE rowid <> '.$this->id.' AND entity = '.$conf->entity.' AND situation_cycle_ref = '.(int) $this->situation_cycle_ref.' ORDER BY situation_counter ASC';
$sql = 'SELECT rowid, situation_counter FROM '.MAIN_DB_PREFIX.'facture';
$sql.= ' WHERE rowid <> '.$this->id;
$sql.= ' AND entity = '.$this->entity;
$sql.= ' AND situation_cycle_ref = '.(int) $this->situation_cycle_ref;
$sql.= ' ORDER BY situation_counter ASC';
dol_syslog(get_class($this).'::fetchPreviousNextSituationInvoice ', LOG_DEBUG);
$result = $this->db->query($sql);
@ -2825,11 +2828,11 @@ class Facture extends CommonInvoice
$pu_ht_devise = $tabprice[19];
// Rank to use
$rangtouse = $rang;
if ($rangtouse == -1)
$ranktouse = $rang;
if ($ranktouse == -1)
{
$rangmax = $this->line_max($fk_parent_line);
$rangtouse = $rangmax + 1;
$ranktouse = $rangmax + 1;
}
// Insert line
@ -2863,7 +2866,7 @@ class Facture extends CommonInvoice
$this->line->date_start=$date_start;
$this->line->date_end=$date_end;
$this->line->ventil=$ventil;
$this->line->rang=$rangtouse;
$this->line->rang=$ranktouse;
$this->line->info_bits=$info_bits;
$this->line->fk_remise_except=$fk_remise_except;
@ -3700,11 +3703,11 @@ class Facture extends CommonInvoice
$sql.= " AND ff.type IS NULL"; // Renvoi vrai si pas facture de remplacement
$sql.= " AND f.type != ".self::TYPE_CREDIT_NOTE; // Type non 2 si facture non avoir
if($conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE){
if (! empty($conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE)) {
// Select the last situation invoice
$sqlSit = 'SELECT MAX(fs.rowid)';
$sqlSit.= " FROM ".MAIN_DB_PREFIX."facture as fs";
$sqlSit.= " WHERE fs.entity = ".$conf->entity;
$sqlSit.= " WHERE fs.entity IN (".getEntity('invoice').")";
$sqlSit.= " AND fs.type = ".self::TYPE_SITUATION;
$sqlSit.= " AND fs.fk_statut in (".self::STATUS_VALIDATED.",".self::STATUS_CLOSED.")";
$sqlSit.= " GROUP BY fs.situation_cycle_ref";
@ -4231,7 +4234,7 @@ class Facture extends CommonInvoice
public function newCycle()
{
$sql = 'SELECT max(situation_cycle_ref) FROM ' . MAIN_DB_PREFIX . 'facture as f';
$sql.= " WHERE f.entity in (".getEntity('invoice', 0).")";
$sql.= " WHERE f.entity IN (".getEntity('invoice', 0).")";
$resql = $this->db->query($sql);
if ($resql) {
if ($resql->num_rows > 0)
@ -4275,8 +4278,8 @@ class Facture extends CommonInvoice
global $conf;
$sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'facture';
$sql .= ' where situation_cycle_ref = ' . $this->situation_cycle_ref;
$sql .= ' and situation_counter < ' . $this->situation_counter;
$sql .= ' WHERE situation_cycle_ref = ' . $this->situation_cycle_ref;
$sql .= ' AND situation_counter < ' . $this->situation_counter;
$sql .= ' AND entity = '. ($this->entity > 0 ? $this->entity : $conf->entity);
$resql = $this->db->query($sql);
$res = array();
@ -4357,7 +4360,9 @@ class Facture extends CommonInvoice
if (!empty($this->situation_cycle_ref)) {
// No point in testing anything if we're not inside a cycle
$sql = 'SELECT max(situation_counter) FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_cycle_ref = ' . $this->situation_cycle_ref . ' AND entity = ' . ($this->entity > 0 ? $this->entity : $conf->entity);
$sql = 'SELECT max(situation_counter) FROM ' . MAIN_DB_PREFIX . 'facture';
$sql.= ' WHERE situation_cycle_ref = ' . $this->situation_cycle_ref;
$sql.= ' AND entity = ' . ($this->entity > 0 ? $this->entity : $conf->entity);
$resql = $this->db->query($sql);
if ($resql && $resql->num_rows > 0) {

View File

@ -97,7 +97,7 @@ if ($id > 0 || ! empty($ref))
{
$object->fetch_thirdparty();
$upload_dir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($object->ref);
$upload_dir = $conf->facture->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
$head = facture_prepare_head($object);
dol_fiche_head($head, 'documents', $langs->trans('InvoiceCustomer'), -1, 'bill');

View File

@ -1231,7 +1231,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation

View File

@ -317,7 +317,7 @@ class ChargeSociales extends CommonObject
$sql.= ", date_ech='".$this->db->idate($this->date_ech)."'";
$sql.= ", periode='".$this->db->idate($this->periode)."'";
$sql.= ", amount='".price2num($this->amount, 'MT')."'";
$sql.= ", fk_projet='".$this->db->escape($this->fk_project)."'";
$sql.= ", fk_projet=".($this->fk_project > 0 ? $this->fk_project : null);
$sql.= ", fk_user_modif=".$user->id;
$sql.= " WHERE rowid=".$this->id;

View File

@ -1217,11 +1217,12 @@ class Contact extends CommonObject
public function getCivilityLabel()
{
global $langs;
$langs->load("dict");
$code=(! empty($this->civility_id)?$this->civility:(! empty($this->civilite)?$this->civilite:''));
$code=($this->civility_code ? $this->civility_code : (! empty($this->civility_id)?$this->civility:(! empty($this->civilite)?$this->civilite:'')));
if (empty($code)) return '';
return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civility", "code", "label", $code);
$langs->load("dict");
return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civility", "code", "label", $code);
}
/**

View File

@ -125,8 +125,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
{
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$link = new Link($db);
$link->id = $linkid;
$link->fetch();
$link->fetch($linkid);
$res = $link->delete($user);
$langs->load('link');
@ -160,8 +159,7 @@ elseif ($action == 'confirm_updateline' && GETPOST('save', 'alpha') && GETPOST('
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$langs->load('link');
$link = new Link($db);
$link->id = GETPOST('linkid', 'int');
$f = $link->fetch();
$f = $link->fetch(GETPOST('linkid', 'int'));
if ($f)
{
$link->url = GETPOST('link', 'alpha');
@ -169,7 +167,7 @@ elseif ($action == 'confirm_updateline' && GETPOST('save', 'alpha') && GETPOST('
{
$link->url = 'http://' . $link->url;
}
$link->label = GETPOST('label', 'alpha');
$link->label = GETPOST('label', 'alphanohtml');
$res = $link->update($user);
if (!$res)
{

View File

@ -17,8 +17,7 @@
/**
* \file htdocs/core/ajax/pingresult.php
* \brief File to save result of anonymous ping
* Example: captureserver/public/index.php?action=dolibarrping
* \brief File to save result of an anonymous ping into database (1 ping is done per installation)
*/
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal

View File

@ -74,6 +74,9 @@ class box_graph_invoices_permonth extends ModeleBoxes
//include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
//$facturestatic=new Facture($db);
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1;
$text = $langs->trans("BoxCustomersInvoicesPerMonth", $max);
$this->info_box_head = array(
'text' => $text,
@ -129,7 +132,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($shownb)
{
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."invoicesnbinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$endyear.'.png';
@ -146,7 +149,14 @@ class box_graph_invoices_permonth extends ModeleBoxes
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
$legend[]=$i;
if ($startmonth != 1)
{
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
}
else
{
$legend[]=$i;
}
$i++;
}
$px1->SetLegend($legend);
@ -167,7 +177,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($showtot)
{
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."invoicesamountinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$endyear.'.png';
@ -184,7 +194,14 @@ class box_graph_invoices_permonth extends ModeleBoxes
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
$legend[]=$i;
if ($startmonth != 1)
{
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
}
else
{
$legend[]=$i;
}
$i++;
}
$px2->SetLegend($legend);

View File

@ -73,6 +73,9 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1;
$text = $langs->trans("BoxSuppliersInvoicesPerMonth", $max);
$this->info_box_head = array(
'text' => $text,
@ -126,7 +129,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($shownb)
{
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."invoicessuppliernbinyear-".$year.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$year.'.png';
@ -143,7 +146,14 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
$legend[]=$i;
if ($startmonth != 1)
{
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
}
else
{
$legend[]=$i;
}
$i++;
}
$px1->SetLegend($legend);
@ -164,7 +174,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($showtot)
{
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."invoicessupplieramountinyear-".$year.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$year.'.png';
@ -181,7 +191,14 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
$legend[]=$i;
if ($startmonth != 1)
{
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
}
else
{
$legend[]=$i;
}
$i++;
}
$px2->SetLegend($legend);

View File

@ -74,6 +74,9 @@ class box_graph_orders_permonth extends ModeleBoxes
//include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
//$commandestatic=new Commande($db);
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1;
$text = $langs->trans("BoxCustomersOrdersPerMonth", $max);
$this->info_box_head = array(
'text' => $text,
@ -129,7 +132,7 @@ class box_graph_orders_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($shownb)
{
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."ordersnbinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersnbinyear-'.$endyear.'.png';
@ -144,7 +147,14 @@ class box_graph_orders_permonth extends ModeleBoxes
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
$legend[]=$i;
if ($startmonth != 1)
{
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
}
else
{
$legend[]=$i;
}
$i++;
}
$px1->SetLegend($legend);
@ -165,7 +175,7 @@ class box_graph_orders_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($showtot)
{
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."ordersamountinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersamountinyear-'.$endyear.'.png';
@ -180,7 +190,14 @@ class box_graph_orders_permonth extends ModeleBoxes
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
$legend[]=$i;
if ($startmonth != 1)
{
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
}
else
{
$legend[]=$i;
}
$i++;
}
$px2->SetLegend($legend);

View File

@ -73,6 +73,9 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1;
$text = $langs->trans("BoxSuppliersOrdersPerMonth", $max);
$this->info_box_head = array(
'text' => $text,
@ -128,7 +131,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($shownb)
{
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."orderssuppliernbinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersnbinyear-'.$endyear.'.png';
@ -143,7 +146,14 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
$legend[]=$i;
if ($startmonth != 1)
{
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
}
else
{
$legend[]=$i;
}
$i++;
}
$px1->SetLegend($legend);
@ -164,7 +174,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($showtot)
{
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$filenamenb = $dir."/".$prefix."orderssupplieramountinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersamountinyear-'.$endyear.'.png';
@ -179,7 +189,14 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
$legend[]=$i;
if ($startmonth != 1)
{
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
}
else
{
$legend[]=$i;
}
$i++;
}
$px2->SetLegend($legend);

View File

@ -74,6 +74,9 @@ class box_graph_propales_permonth extends ModeleBoxes
//include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
//$propalstatic=new Propal($db);
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1;
$langs->load("propal");
$text = $langs->trans("BoxProposalsPerMonth", $max);
@ -128,7 +131,7 @@ class box_graph_propales_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($shownb)
{
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$datatype1 = array_pad(array(), ($endyear-$startyear+1), 'bars');
$filenamenb = $dir."/".$prefix."propalsnbinyear-".$endyear.".png";
@ -144,7 +147,14 @@ class box_graph_propales_permonth extends ModeleBoxes
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
$legend[]=$i;
if ($startmonth != 1)
{
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
}
else
{
$legend[]=$i;
}
$i++;
}
$px1->SetLegend($legend);
@ -165,7 +175,7 @@ class box_graph_propales_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($showtot)
{
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
$datatype2 = array_pad(array(), ($endyear-$startyear+1), 'bars');
//$datatype2 = array('lines','bars');
@ -183,7 +193,14 @@ class box_graph_propales_permonth extends ModeleBoxes
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
$legend[]=$i;
if ($startmonth != 1)
{
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
}
else
{
$legend[]=$i;
}
$i++;
}
$px2->SetLegend($legend);

View File

@ -1913,7 +1913,7 @@ abstract class CommonObject
* Change the multicurrency rate
*
* @param double $rate multicurrency rate
* @param int $mode mode 1 : amounts in company currency will be recalculated, mode 2 : amounts in foreign currency
* @param int $mode mode 1 : amounts in company currency will be recalculated, mode 2 : amounts in foreign currency will be recalculated
* @return int >0 if OK, <0 if KO
*/
public function setMulticurrencyRate($rate, $mode = 1)
@ -1936,10 +1936,16 @@ abstract class CommonObject
{
foreach ($this->lines as &$line)
{
// Amounts in company currency will be recalculated
if($mode == 1) {
$line->subprice = 0;
}
// Amounts in foreign currency will be recalculated
if($mode == 2) {
$line->multicurrency_subprice = 0;
}
switch ($this->element) {
case 'propal':
$this->updateline(

View File

@ -327,6 +327,9 @@ class Conf
}
// For mycompany storage
$this->mycompany->multidir_output = array($this->entity => $rootfordata."/mycompany");
$this->mycompany->multidir_temp = array($this->entity => $rootfordata."/mycompany/temp");
// For backward compatibility
$this->mycompany->dir_output=$rootfordata."/mycompany";
$this->mycompany->dir_temp=$rootfordata."/mycompany/temp";

View File

@ -1094,7 +1094,7 @@ class DolGraph
$i++;
}
// shadowSize: 0 -> Drawing is faster without shadows
$this->stringtoshow.="\n".' ], { series: { shadowSize: 0, stack: stack, lines: { fill: false, steps: steps }, bars: { barWidth: 0.6 } }'."\n";
$this->stringtoshow.="\n".' ], { series: { shadowSize: 0, stack: stack, lines: { fill: false, steps: steps }, bars: { barWidth: 0.6, fillColor: { colors: [{opacity: 0.9 }, {opacity: 0.85}] }} }'."\n";
// Xaxis
$this->stringtoshow.=', xaxis: { ticks: ['."\n";

View File

@ -307,7 +307,7 @@ class Form
* @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage')
* @return string HTML edit in place
*/
private function editInPlace($object, $value, $htmlname, $condition, $inputType = 'textarea', $editvalue = null, $extObject = null, $custommsg = null)
protected function editInPlace($object, $value, $htmlname, $condition, $inputType = 'textarea', $editvalue = null, $extObject = null, $custommsg = null)
{
global $conf;
@ -523,7 +523,7 @@ class Form
* @param string $extracss Add a CSS style to td, div or span tag
* @param int $noencodehtmltext Do not encode into html entity the htmltext
* @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span
* @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key)
* @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key, clickable link is on image or on link if param $type='none')
* @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only)
* @return string HTML code of text, picto, tooltip
*/
@ -2362,7 +2362,7 @@ class Form
* @param string $filterkey Filter key to highlight
* @return void
*/
private function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected, $hidepriceinlabel = 0, $filterkey = '')
protected function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected, $hidepriceinlabel = 0, $filterkey = '')
{
global $langs, $conf, $user, $db;

View File

@ -1258,7 +1258,7 @@ class FormFile
print '</a>';
}
// Preview link
if (! $editline) print $this->showPreview($file, $modulepart, $filepath);
if (! $editline) print $this->showPreview($file, $modulepart, $filepath, 0, '&entity='.(! empty($object->entity)?$object->entity:$conf->entity));
print "</td>\n";
@ -1839,7 +1839,7 @@ class FormFile
print $langs->trans('Link') . ': <input type="text" name="link" value="' . $link->url . '">';
print '</td>';
print '<td>';
print $langs->trans('Label') . ': <input type="text" name="label" value="' . $link->label . '">';
print $langs->trans('Label') . ': <input type="text" name="label" value="' . dol_escape_htmltag($link->label) . '">';
print '</td>';
print '<td class="center">' . dol_print_date(dol_now(), "dayhour", "tzuser") . '</td>';
print '<td class="right"></td>';
@ -1853,7 +1853,7 @@ class FormFile
print '<td>';
print img_picto('', 'object_globe').' ';
print '<a data-ajax="false" href="' . $link->url . '" target="_blank">';
print $link->label;
print dol_escape_htmltag($link->label);
print '</a>';
print '</td>'."\n";
print '<td class="right"></td>';

View File

@ -153,7 +153,7 @@ class FormProjets
$outarray=array();
$hideunselectables = false;
if (! empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) $hideunselectables = true;
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
$projectsListId = false;
if (empty($user->rights->projet->all->lire))

View File

@ -176,7 +176,21 @@ class FormWebsite
$langs->load("admin");
$arrayofsamples=array('empty'=>'EmptyPage', 'corporatehome'=>'CorporateHomePage');
$listofsamples = dol_dir_list(DOL_DOCUMENT_ROOT.'/website/samples', 'files', 0, '^page-sample-.*\.html$');
$arrayofsamples = array();
$arrayofsamples['empty']='EmptyPage'; // Always this one first
foreach($listofsamples as $sample)
{
$reg = array();
if (preg_match('/^page-sample-(.*)\.html$/', $sample['name'], $reg))
{
$key = $reg[1];
$labelkey = ucfirst($key);
if ($key == 'empty') $labelkey = 'EmptyPage';
$arrayofsamples[$key] = $labelkey;
}
}
$out = '';
$out .= '<select id="select'.$htmlname.'" class="flat selectTypeOfContainer" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';

File diff suppressed because it is too large Load Diff

View File

@ -39,10 +39,12 @@ abstract class Stats
* @param int $endyear Start year
* @param int $startyear End year
* @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save)
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of values
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @param int $startmonth month of the fiscal year start min 1 max 12 ; if 1 = january
* @return array Array of values
*/
public function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0)
public function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 1)
{
global $conf,$user,$langs;
@ -86,6 +88,8 @@ abstract class Stats
else
{
$year=$startyear;
$sm = $startmonth - 1;
if ($sm != 0) $year = $year - 1;
while ($year <= $endyear)
{
$datay[$year] = $this->getNbByMonth($year, $format);
@ -96,11 +100,11 @@ abstract class Stats
for ($i = 0 ; $i < 12 ; $i++)
{
$data[$i][]=$datay[$endyear][$i][0];
$data[$i][]=$datay[$endyear][($i+$sm)%12][0];
$year=$startyear;
while($year <= $endyear)
{
$data[$i][]=$datay[$year][$i][1];
$data[$i][]=$datay[$year - (1 - ((int) ($i+$sm)/12)) + ($sm == 0 ? 1 : 0)][($i+$sm)%12][1];
$year++;
}
}
@ -134,9 +138,10 @@ abstract class Stats
* @param int $startyear End year
* @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save)
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @param int $startmonth month of the fiscal year start min 1 max 12 ; if 1 = january
* @return array Array of values
*/
public function getAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0)
public function getAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 1)
{
global $conf,$user,$langs;
@ -181,6 +186,8 @@ abstract class Stats
else
{
$year=$startyear;
$sm = $startmonth - 1;
if ($sm != 0) $year = $year - 1;
while($year <= $endyear)
{
$datay[$year] = $this->getAmountByMonth($year, $format);
@ -191,11 +198,11 @@ abstract class Stats
// $data = array('xval'=>array(0=>xlabel,1=>yval1,2=>yval2...),...)
for ($i = 0 ; $i < 12 ; $i++)
{
$data[$i][]=$datay[$endyear][$i][0]; // set label
$data[$i][]=$datay[$endyear][($i+$sm)%12][0]; // set label
$year=$startyear;
while($year <= $endyear)
{
$data[$i][]=$datay[$year][$i][1]; // set yval for x=i
$data[$i][]=$datay[$year - (1 - ((int) ($i+$sm)/12)) + ($sm == 0 ? 1 : 0)][($i+$sm)%12][1]; // set yval for x=i
$year++;
}
}
@ -411,7 +418,8 @@ abstract class Stats
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Renvoie le nombre de proposition par mois pour une annee donnee
* Renvoie le nombre de documents par mois pour une annee donnee
* Return number of documents per month for a given year
*
* @param int $year Year
* @param string $sql SQL
@ -470,7 +478,8 @@ abstract class Stats
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Renvoie le nombre d'element par mois pour une annee donnee
* Renvoie le montant totalise par mois pour une annee donnee
* Return the amount per month for a given year
*
* @param int $year Year
* @param string $sql SQL
@ -527,6 +536,7 @@ abstract class Stats
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Renvoie le montant moyen par mois pour une annee donnee
* Return the amount average par month for a given year
*
* @param int $year Year
* @param string $sql SQL

View File

@ -802,7 +802,7 @@ class Utils
dol_include_once('/core/lib/files.lib.php');
$nbSaves = ! empty($conf->global->SYSLOG_FILE_SAVES) ? intval($conf->global->SYSLOG_FILE_SAVES) : 14;
$nbSaves = empty($conf->global->SYSLOG_FILE_SAVES) ? 10 : intval($conf->global->SYSLOG_FILE_SAVES);
if (empty($conf->global->SYSLOG_FILE)) {
$mainlogdir = DOL_DATA_ROOT;

View File

@ -856,7 +856,8 @@ function newpopup(url, title) {
}
/**
* Function show document preview. Use the "dialog" function.
* Function show document preview. It uses the "dialog" function.
* The a tag around the img must have the src='', class='documentpreview', mime='image/xxx', target='_blank' from getAdvancedPreviewUrl().
*
* @param string file Url
* @param string type Mime file type ("image/jpeg", "application/pdf", "text/html")

View File

@ -555,6 +555,7 @@ function dol_count_nb_of_line($file)
*
* @param string $pathoffile Path of file
* @return integer File size
* @see dol_print_size()
*/
function dol_filesize($pathoffile)
{
@ -985,6 +986,7 @@ function dolCheckVirus($src_file)
* - This function can be used only into a HTML page context. Use dol_move if you are outside.
* - Test on antivirus is always done (if antivirus set).
* - Database of files is NOT updated (this is done by dol_add_file_process() that calls this function).
* - Extension .noexe may be added if file is executable and MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED is not set.
*
* @param string $src_file Source full path filename ($_FILES['field']['tmp_name'])
* @param string $dest_file Target full path filename ($_FILES['field']['name'])
@ -1063,15 +1065,15 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
// Security:
// We refuse cache files/dirs, upload using .. and pipes into filenames.
if (preg_match('/^\./', $src_file) || preg_match('/\.\./', $src_file) || preg_match('/[<>|]/', $src_file))
if (preg_match('/^\./', basename($src_file)) || preg_match('/\.\./', $src_file) || preg_match('/[<>|]/', $src_file))
{
dol_syslog("Refused to deliver file ".$src_file, LOG_WARNING);
return -1;
}
// Security:
// On interdit fichiers caches, remontees de repertoire ainsi que les pipe dans les noms de fichiers.
if (preg_match('/^\./', $dest_file) || preg_match('/\.\./', $dest_file) || preg_match('/[<>|]/', $dest_file))
// We refuse cache files/dirs, upload using .. and pipes into filenames.
if (preg_match('/^\./', basename($dest_file)) || preg_match('/\.\./', $dest_file) || preg_match('/[<>|]/', $dest_file))
{
dol_syslog("Refused to deliver file ".$dest_file, LOG_WARNING);
return -2;
@ -1888,24 +1890,87 @@ function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '', $page = ''
*/
function dol_compress_file($inputfile, $outputfile, $mode = "gz")
{
global $conf;
$foundhandler=0;
try
{
dol_syslog("dol_compress_file mode=".$mode." inputfile=".$inputfile." outputfile=".$outputfile);
$data = implode("", file(dol_osencode($inputfile)));
if ($mode == 'gz') { $foundhandler=1; $compressdata = gzencode($data, 9); }
elseif ($mode == 'bz') { $foundhandler=1; $compressdata = bzcompress($data, 9); }
elseif ($mode == 'zip')
{
if (class_exists('ZipArchive') && ! empty($conf->global->MAIN_USE_ZIPARCHIVE_FOR_ZIP_COMPRESS))
{
$foundhandler=1;
$rootPath = realpath($inputfile);
dol_syslog("Class ZipArchive is set so we zip using ZipArchive to zip into ".$outputfile.' rootPath='.$rootPath);
$zip = new ZipArchive;
if ($zip->open($outputfile, ZipArchive::CREATE) !== true) {
$errormsg="Failed to open file ".$outputfile."\n";
dol_syslog("dol_compress_file failure - ".$errormsg, LOG_ERR);
return -6;
}
// Create recursive directory iterator
/** @var SplFileInfo[] $files */
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($rootPath),
RecursiveIteratorIterator::LEAVES_ONLY
);
foreach ($files as $name => $file)
{
// Skip directories (they would be added automatically)
if (!$file->isDir())
{
// Get real and relative path for current file
$filePath = $file->getRealPath();
$relativePath = substr($filePath, strlen($rootPath) + 1);
// Add current file to archive
$zip->addFile($filePath, $relativePath);
}
}
// Zip archive will be created only after closing object
$zip->close();
dol_syslog("dol_compress_file success - ".count($zip->numFiles)." files");
return 1;
}
if (defined('ODTPHP_PATHTOPCLZIP'))
{
$foundhandler=1;
include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php';
$archive = new PclZip($outputfile);
$archive->add($inputfile, PCLZIP_OPT_REMOVE_PATH, dirname($inputfile));
//$archive->add($inputfile);
return 1;
$result = $archive->add($inputfile, PCLZIP_OPT_REMOVE_PATH, dirname($inputfile));
if ($result === 0)
{
global $errormsg;
$errormsg=$archive->errorInfo(true);
dol_syslog("dol_compress_file failure - ".$errormsg, LOG_ERR);
if ($archive->errorCode() == PCLZIP_ERR_WRITE_OPEN_FAIL)
{
dol_syslog("dol_compress_file error PCLZIP_ERR_WRITE_OPEN_FAIL", LOG_ERR);
return -4;
}
return -3;
}
else
{
dol_syslog("dol_compress_file success - ".count($result)." files");
return 1;
}
}
}
@ -1941,9 +2006,9 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz")
*/
function dol_uncompress($inputfile, $outputdir)
{
global $langs;
global $conf, $langs;
if (defined('ODTPHP_PATHTOPCLZIP'))
if (defined('ODTPHP_PATHTOPCLZIP') && empty($conf->global->MAIN_USE_ZIPARCHIVE_FOR_ZIP_UNCOMPRESS))
{
dol_syslog("Constant ODTPHP_PATHTOPCLZIP for pclzip library is set to ".ODTPHP_PATHTOPCLZIP.", so we use Pclzip to unzip into ".$outputdir);
include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php';
@ -2164,6 +2229,12 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$accessallowed=($user->admin && basename($original_file) == $original_file && preg_match('/^dolibarr.*\.log$/', basename($original_file)));
$original_file=$dolibarr_main_data_root.'/'.$original_file;
}
// Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log
elseif ($modulepart == 'doctemplateswebsite' && !empty($dolibarr_main_data_root))
{
$accessallowed=($fuser->rights->website->write && preg_match('/\.jpg$/i', basename($original_file)));
$original_file=$dolibarr_main_data_root.'/doctemplates/websites/'.$original_file;
}
// Wrapping for *.zip files, like when used with url http://.../document.php?modulepart=packages&file=module_myfile.zip
elseif ($modulepart == 'packages' && !empty($dolibarr_main_data_root))
{
@ -2193,10 +2264,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$original_file=$conf->adherent->dir_output.'/'.$original_file;
}
// Wrapping pour les apercu factures
elseif ($modulepart == 'apercufacture' && !empty($conf->facture->dir_output))
elseif ($modulepart == 'apercufacture' && !empty($conf->facture->multidir_output[$entity]))
{
if ($fuser->rights->facture->{$lire}) $accessallowed=1;
$original_file=$conf->facture->dir_output.'/'.$original_file;
$original_file=$conf->facture->multidir_output[$entity].'/'.$original_file;
}
// Wrapping pour les apercu propal
elseif ($modulepart == 'apercupropal' && !empty($conf->propal->multidir_output[$entity]))
@ -2205,10 +2276,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$original_file=$conf->propal->multidir_output[$entity].'/'.$original_file;
}
// Wrapping pour les apercu commande
elseif ($modulepart == 'apercucommande' && !empty($conf->commande->dir_output))
elseif ($modulepart == 'apercucommande' && !empty($conf->commande->multidir_output[$entity]))
{
if ($fuser->rights->commande->{$lire}) $accessallowed=1;
$original_file=$conf->commande->dir_output.'/'.$original_file;
$original_file=$conf->commande->multidir_output[$entity].'/'.$original_file;
}
// Wrapping pour les apercu intervention
elseif (($modulepart == 'apercufichinter' || $modulepart == 'apercuficheinter') && !empty($conf->ficheinter->dir_output))
@ -2404,13 +2475,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
}
// Wrapping for invoices
elseif (($modulepart == 'facture' || $modulepart == 'invoice') && !empty($conf->facture->dir_output))
elseif (($modulepart == 'facture' || $modulepart == 'invoice') && !empty($conf->facture->multidir_output[$entity]))
{
if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file))
{
$accessallowed=1;
}
$original_file=$conf->facture->dir_output.'/'.$original_file;
$original_file=$conf->facture->multidir_output[$entity].'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
}
// Wrapping for mass actions
@ -2428,15 +2499,23 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
{
$accessallowed=1;
}
$original_file=$conf->commande->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
$original_file=$conf->commande->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file;
}
elseif ($modulepart == 'massfilesarea_sendings')
{
if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file))
{
$accessallowed=1;
}
$original_file=$conf->expedition->dir_output.'/sending/temp/massgeneration/'.$user->id.'/'.$original_file;
}
elseif ($modulepart == 'massfilesarea_invoices')
{
if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file))
{
$accessallowed=1;
}
$original_file=$conf->facture->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
$original_file=$conf->facture->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file;
}
elseif ($modulepart == 'massfilesarea_expensereport')
{
@ -2520,13 +2599,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
}
// Wrapping pour les commandes
elseif (($modulepart == 'commande' || $modulepart == 'order') && !empty($conf->commande->dir_output))
elseif (($modulepart == 'commande' || $modulepart == 'order') && !empty($conf->commande->multidir_output[$entity]))
{
if ($fuser->rights->commande->{$lire} || preg_match('/^specimen/i', $original_file))
{
$accessallowed=1;
}
$original_file=$conf->commande->dir_output.'/'.$original_file;
$original_file=$conf->commande->multidir_output[$entity].'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
}
@ -2849,7 +2928,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
{
if (empty($conf->$modulepart->dir_output)) // modulepart not supported
{
dol_print_error('', 'Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')');
dol_print_error('', 'Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.'). The module for this modulepart value may not be activated.');
exit;
}

View File

@ -5,7 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2005-2019 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2018 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
@ -75,7 +75,7 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port)
* @param int $shared 0=Return id of current entity only,
* 1=Return id of current entity + shared entities (default)
* @param object $currentobject Current object if needed
* @return mixed Entity id(s) to use
* @return mixed Entity id(s) to use ( eg. entity IN ('.getEntity(elementname).')' )
*/
function getEntity($element, $shared = 1, $currentobject = null)
{
@ -95,6 +95,26 @@ function getEntity($element, $shared = 1, $currentobject = null)
}
}
/**
* Set entity id to use when to create an object
*
* @param object $currentobject Current object
* @return mixed Entity id to use ( eg. entity = '.setEntity($object) )
*/
function setEntity($currentobject)
{
global $conf, $mc;
if (is_object($mc))
{
return $mc->setEntity($currentobject);
}
else
{
return ((is_object($currentobject) && $currentobject->id > 0 && $currentobject->entity > 0) ? $currentobject->entity : $conf->entity);
}
}
/**
* Return information about user browser
*
@ -796,7 +816,8 @@ function dol_size($size, $type = '')
*/
function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1)
{
$filesystem_forbidden_chars = array('<','>','/','\\','?','*','|','"','°');
// List of special chars for filenames are defined on page https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
$filesystem_forbidden_chars = array('<', '>', '/', '\\', '?', '*', '|', '"', ':', '°');
return dol_string_nospecial($unaccent?dol_string_unaccent($str):$str, $newstr, $filesystem_forbidden_chars);
}

View File

@ -576,6 +576,7 @@ function isValidVATID($company)
{
$vatprefix = $company->country_code;
if ($vatprefix == 'GR') $vatprefix = '(EL|GR)';
elseif ($vatprefix == 'MC') $vatprefix = 'FR'; // Monaco is using french VAT numbers
else $vatprefix = preg_quote($vatprefix, '/');
if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.]{5,14}$/i', str_replace(' ', '', $company->tva_intra)))
{

View File

@ -96,7 +96,7 @@ function commande_prepare_head(Commande $object)
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
$upload_dir = $conf->commande->multidir_output[$object->entity] . "/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks=Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$object->id;

View File

@ -295,10 +295,9 @@ function user_admin_prepare_head()
* @param boolean $foruserprofile Show for user profile view
* @return void
*/
function show_theme($fuser, $edit = 0, $foruserprofile = false)
function showSkins($fuser, $edit = 0, $foruserprofile = false)
{
global $conf,$langs,$db,$form;
global $bc;
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
@ -351,9 +350,7 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false)
{
print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("DefaultSkin").'</th>';
print '<th class="right">';
$url='https://www.dolistore.com/lang-en/4-skins';
if (preg_match('/fr/i', $langs->defaultlang)) $url='https://www.dolistore.com/fr/4-themes';
//if (preg_match('/es/i',$langs->defaultlang)) $url='http://www.dolistore.com/lang-es/4-themes';
$url='https://www.dolistore.com/4-skins';
print '<a href="'.$url.'" target="_blank">';
print $langs->trans('DownloadMoreSkins');
print '</a>';
@ -432,7 +429,7 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false)
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
print '<td>'.($conf->global->THEME_TOPMENU_DISABLE_IMAGE?$conf->global->THEME_TOPMENU_DISABLE_IMAGE:$langs->trans("Default")).'</td>';
print '<td class="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_THEME_TOPMENU_DISABLE_IMAGE" id="check_THEME_TOPMENU_DISABLE_IMAGE" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TEXTLINK)?" checked":"");
print '<td class="left" class="nowrap" width="20%"><input name="check_THEME_TOPMENU_DISABLE_IMAGE" id="check_THEME_TOPMENU_DISABLE_IMAGE" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TEXTLINK)?" checked":"");
print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
print '> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>';
@ -477,7 +474,7 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false)
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
print '<td class="nowrap left" width="20%"><input '.$bc[$var].' name="check_THEME_ELDY_TOPMENU_BACK1" id="check_THEME_ELDY_TOPMENU_BACK1" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TOPMENU_BACK1)?" checked":"");
print '<td class="nowrap left" width="20%"><input name="check_THEME_ELDY_TOPMENU_BACK1" id="check_THEME_ELDY_TOPMENU_BACK1" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TOPMENU_BACK1)?" checked":"");
print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
print '> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>';
@ -524,7 +521,7 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false)
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
print '<td class="nowrap left" width="20%"><input '.$bc[$var].' name="check_THEME_ELDY_TOPMENU_BACK1" id="check_THEME_ELDY_TOPMENU_BACK1" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TOPMENU_BACK1)?" checked":"");
print '<td class="nowrap left" width="20%"><input name="check_THEME_ELDY_TOPMENU_BACK1" id="check_THEME_ELDY_TOPMENU_BACK1" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TOPMENU_BACK1)?" checked":"");
print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
print '> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>';
@ -573,7 +570,7 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false)
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_VERMENU_BACK1:$langs->trans("Default")).'</td>';
print '<td class="nowrap left" width="20%"><input '.$bc[$var].' name="check_THEME_ELDY_VERMENU_BACK1" id="check_THEME_ELDY_VERMENU_BACK1" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TOPMENU_BACK1)?" checked":"");
print '<td class="nowrap left" width="20%"><input name="check_THEME_ELDY_VERMENU_BACK1" id="check_THEME_ELDY_VERMENU_BACK1" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TOPMENU_BACK1)?" checked":"");
print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
print '> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>';
@ -763,7 +760,7 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false)
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TEXTLINK:$langs->trans("Default")).'</td>';
print '<td class="nowrap left" width="20%"><input '.$bc[$var].' name="check_THEME_ELDY_TEXTLINK" id="check_THEME_ELDY_TEXTLINK" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TEXTLINK)?" checked":"");
print '<td class="nowrap left" width="20%"><input name="check_THEME_ELDY_TEXTLINK" id="check_THEME_ELDY_TEXTLINK" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TEXTLINK)?" checked":"");
print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
print '> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>';
@ -813,9 +810,9 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false)
/* Must first change option to choose color of highlight instead of yes or no.
print '<tr class="oddeven">';
print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>';
print '<td class="nowrap left" width="20%"><input '.$bc[$var].' name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled="disabled"').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
print '<td><input name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>';
print '<td class="nowrap left" width="20%"><input name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
print '<td><input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled="disabled"').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
print '</td>';
print '</tr>';
@ -825,7 +822,7 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false)
print '<tr class="oddeven">';
print '<td>'.$langs->trans("HighlightLinesColor").'</td>';
print '<td colspan="'.($colspan-1).'">';
//print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
//print '<input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
//print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
if ($edit)
{
@ -856,9 +853,9 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false)
/* Must first change option to choose color of highlight instead of yes or no.
print '<tr class="oddeven">';
print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>';
print '<td class="nowrap left" width="20%"><input '.$bc[$var].' name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled="disabled"').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
print '<td><input name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>';
print '<td class="nowrap left" width="20%"><input name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
print '<td><input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled="disabled"').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
print '</td>';
print '</tr>';
@ -869,7 +866,7 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false)
print '<tr class="oddeven">';
print '<td>'.$langs->trans("HighlightLinesChecked").'</td>';
print '<td colspan="'.($colspan-1).'">';
//print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
//print '<input name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
//print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
if ($edit)
{
@ -947,5 +944,45 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false)
*/
}
// Use MAIN_OPTIMIZEFORTEXTBROWSER
if ($foruserprofile)
{
//$default=yn($conf->global->MAIN_OPTIMIZEFORCOLORBLIND);
$default=$langs->trans('No');
print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_OPTIMIZEFORCOLORBLIND").'</td>';
print '<td colspan="'.($colspan-1).'">';
$colorBlindOptions = array(
0 => $langs->trans('No'),
'flashy' => $langs->trans('Flashy'),
'protanopia' => $langs->trans('Protanopia'),
'deuteranopes' => $langs->trans('Deuteranopes'),
'tritanopes' => $langs->trans('Tritanopes'),
);
if ($edit)
{
print $form->selectArray('MAIN_OPTIMIZEFORCOLORBLIND', $colorBlindOptions, $fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND, 0);
}
else
{
if (!empty($fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND) && isset($colorBlindOptions[$fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND])){
print $colorBlindOptions[$fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND];
}
else{
print yn(0);
}
}
print ' &nbsp; ('.$langs->trans("Default").': <strong>'.$default.'</strong>) ';
print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORCOLORBLINDDesc"));
print '</td>';
print '</tr>';
}
else
{
}
print '</table>';
}

View File

@ -22,78 +22,6 @@
*/
/**
* Convert a page content to have correct links (based on DOL_URL_ROOT) into an html content.
* Used to ouput the page on the Preview from backoffice.
*
* @param Website $website Web site object
* @param string $content Content to replace
* @param int $removephppart 0=Replace PHP sections with a PHP badge. 1=Remove completely PHP sections.
* @return boolean True if OK
* @see dolWebsiteOutput() for function used to replace content in a web server context
*/
function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0)
{
$nbrep = 0;
// Replace php code. Note $content may come from database and does not contains body tags.
$replacewith='...php...';
if ($removephppart) $replacewith='';
$content = preg_replace('/value="<\?php((?!\?>).)*\?>\n*/ims', 'value="'.$replacewith.'"', $content);
$replacewith='"callto=#';
if ($removephppart) $replacewith='';
$content = preg_replace('/"callto:<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
$replacewith='"mailto=#';
if ($removephppart) $replacewith='';
$content = preg_replace('/"mailto:<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
$replacewith='src="php';
if ($removephppart) $replacewith='';
$content = preg_replace('/src="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
$replacewith='href="php';
if ($removephppart) $replacewith='';
$content = preg_replace('/href="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
//$replacewith='<span class="phptag">...php...</span>';
$replacewith='<span class="phptag">...php...</span>';
if ($removephppart) $replacewith='';
//$content = preg_replace('/<\?php((?!\?toremove>).)*\?toremove>\n*/ims', $replacewith, $content);
/*if ($content === null) {
if (preg_last_error() == PREG_JIT_STACKLIMIT_ERROR) $content = 'preg_replace error (when removing php tags) PREG_JIT_STACKLIMIT_ERROR';
}*/
$content = dolStripPhpCode($content, $replacewith);
//var_dump($content);
// Replace relative link / with dolibarr URL
$content = preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep);
// Replace relative link /xxx.php with dolibarr URL
$content = preg_replace('/(href=")\/?([^:\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
// Fix relative link into medias with correct URL after the DOL_URL_ROOT: ../url("medias/
$content = preg_replace('/url\((["\']?)medias\//', 'url(\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
$content = preg_replace('/data-slide-bg=(["\']?)medias\//', 'data-slide-bg=\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
// <img src="medias/image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
$content = preg_replace('/(<img[^>]*src=")(medias\/)/', '\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
// <img src="image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
$content = preg_replace('/(<img[^>]*src=")(?!(http|\/?viewimage|'.preg_quote(DOL_URL_ROOT, '/').'\/viewimage))/', '\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
// <img src="viewimage.php/modulepart=medias&file=image.png" => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png"
$content = preg_replace('/(<img[^>]*src=")(\/?viewimage\.php)/', '\1'.DOL_URL_ROOT.'/viewimage.php', $content, -1, $nbrep);
// action="newpage.php" => action="dolibarr/website/index.php?website=...&pageref=newpage
$content = preg_replace('/(action=")\/?([^:\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
// Fix relative link /document.php with correct URL after the DOL_URL_ROOT: ...href="/document.php?modulepart="
$content=preg_replace('/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
$content=preg_replace('/(src=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
return $content;
}
/**
* Remove PHP code part from a string.
*
@ -119,14 +47,15 @@ function dolStripPhpCode($str, $replacewith = '')
$newstr .= $part;
continue;
}
//split on closing tag
// The second part is the php code. We split on closing tag
$partlings = explode('?>', $part);
if (!empty($partlings))
{
$phppart = $partlings[0];
//remove content before closing tag
if (count($partlings) > 1) $partlings[0] = '';
if (count($partlings) > 1) $partlings[0] = ''; // Todo why a count > 1 and not >= 1 ?
//append to out string
$newstr .= $replacewith.implode('', $partlings);
$newstr .= '<span class="phptag">'.$replacewith.'<!-- '.$phppart.' --></span>'.implode('', $partlings);
}
}
}
@ -142,50 +71,154 @@ function dolStripPhpCode($str, $replacewith = '')
*/
function dolKeepOnlyPhpCode($str)
{
$newstr = '';
$newstr = '';
//split on each opening tag
$parts = explode('<?php', $str);
if (!empty($parts))
{
$i=0;
foreach($parts as $part)
{
if ($i == 0) // The first part is never php code
{
$i++;
continue;
}
$newstr.='<?php';
//split on closing tag
$partlings = explode('?>', $part, 2);
if (!empty($partlings))
{
$newstr .= $partlings[0].'?>';
}
else
{
$newstr .= $part.'?>';
}
}
}
return $newstr;
//split on each opening tag
$parts = explode('<?php', $str);
if (!empty($parts))
{
$i=0;
foreach($parts as $part)
{
if ($i == 0) // The first part is never php code
{
$i++;
continue;
}
$newstr.='<?php';
//split on closing tag
$partlings = explode('?>', $part, 2);
if (!empty($partlings))
{
$newstr .= $partlings[0].'?>';
}
else
{
$newstr .= $part.'?>';
}
}
}
return $newstr;
}
/**
* Convert a page content to have correct links (based on DOL_URL_ROOT) into an html content. It replaces also dynamic content with '...php...'
* Used to ouput the page on the Preview from backoffice.
*
* @param Website $website Web site object
* @param string $content Content to replace
* @param int $removephppart 0=Replace PHP sections with a PHP badge. 1=Remove completely PHP sections.
* @param string $contenttype Content type
* @param int $containerid Contenair id
* @return boolean True if OK
* @see dolWebsiteOutput() for function used to replace content in a web server context
*/
function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0, $contenttype = 'html', $containerid = '')
{
$nbrep = 0;
dol_syslog('dolWebsiteReplacementOfLinks start (contenttype='.$contenttype." containerid=".$containerid." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR')?'1':'')." USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER')?'1':'').')', LOG_DEBUG);
//if ($contenttype == 'html') { print $content;exit; }
// Replace php code. Note $content may come from database and does not contains body tags.
$replacewith='...php...';
if ($removephppart) $replacewith='';
$content = preg_replace('/value="<\?php((?!\?>).)*\?>\n*/ims', 'value="'.$replacewith.'"', $content);
$replacewith='"callto=#';
if ($removephppart) $replacewith='';
$content = preg_replace('/"callto:<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
$replacewith='"mailto=#';
if ($removephppart) $replacewith='';
$content = preg_replace('/"mailto:<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
$replacewith='src="php';
if ($removephppart) $replacewith='';
$content = preg_replace('/src="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
$replacewith='href="php';
if ($removephppart) $replacewith='';
$content = preg_replace('/href="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
//$replacewith='<span class="phptag">...php...</span>';
$replacewith='...php...';
if ($removephppart) $replacewith='';
//$content = preg_replace('/<\?php((?!\?toremove>).)*\?toremove>\n*/ims', $replacewith, $content);
/*if ($content === null) {
if (preg_last_error() == PREG_JIT_STACKLIMIT_ERROR) $content = 'preg_replace error (when removing php tags) PREG_JIT_STACKLIMIT_ERROR';
}*/
$content = dolStripPhpCode($content, $replacewith);
//var_dump($content);
// Protect the link styles.css.php to any replacement that we make after.
$content = str_replace('href="styles.css.php', 'href="!~!~!~styles.css.php', $content);
$content = str_replace('href="http', 'href="!~!~!~http', $content);
$content = str_replace('href="//', 'href="!~!~!~//', $content);
$content = str_replace('src="viewimage.php', 'src="!~!~!~/viewimage.php', $content);
$content = str_replace('src="/viewimage.php', 'src="!~!~!~/viewimage.php', $content);
$content = str_replace('src="'.DOL_URL_ROOT.'/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content);
$content = str_replace('href="document.php', 'href="!~!~!~/document.php', $content);
$content = str_replace('href="/document.php', 'href="!~!~!~/document.php', $content);
$content = str_replace('href="'.DOL_URL_ROOT.'/document.php', 'href="!~!~!~'.DOL_URL_ROOT.'/document.php', $content);
// Replace relative link '/' with dolibarr URL
$content = preg_replace('/(href=")\/\"/', '\1!~!~!~'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep);
// Replace relative link /xxx.php#aaa or /xxx.php with dolibarr URL (we discard param ?...)
$content = preg_replace('/(href=")\/?([^:\"\!]*)\.php(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2\3"', $content, -1, $nbrep);
// Replace relative link /xxx.php?a=b&c=d#aaa or /xxx.php?a=b&c=d with dolibarr URL
$content = preg_replace('/(href=")\/?([^:\"\!]*)\.php\?([^#\"<>]*)(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2&\3\4"', $content, -1, $nbrep);
// Fix relative link into medias with correct URL after the DOL_URL_ROOT: ../url("medias/
$content = preg_replace('/url\((["\']?)medias\//', 'url(\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
$content = preg_replace('/data-slide-bg=(["\']?)medias\//', 'data-slide-bg=\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
// <img src="medias/...image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
// <img src="...image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
$content = preg_replace('/(<img[^>]*src=")\/?medias\//', '\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
// <img src="image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
$content = preg_replace('/(<img[^>]*src=")\/?([^:\"\!]+)\"/', '\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=\2"', $content, -1, $nbrep);
// <img src="viewimage.php/modulepart=medias&file=image.png" => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png"
$content = preg_replace('/(<img[^>]*src=")(\/?viewimage\.php)/', '\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content, -1, $nbrep);
// action="newpage.php" => action="dolibarr/website/index.php?website=...&pageref=newpage
$content = preg_replace('/(action=")\/?([^:\"]*)(\.php\")/', '\1!~!~!~'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
// Fix relative link /document.php with correct URL after the DOL_URL_ROOT: ...href="/document.php?modulepart="
$content=preg_replace('/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
$content=preg_replace('/(src=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
// Fix relative link /viewimage.php with correct URL after the DOL_URL_ROOT: ...href="/viewimage.php?modulepart="
$content=preg_replace('/(url\(")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
// Fix relative URL
$content = str_replace('src="!~!~!~/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content);
$content = str_replace('href="!~!~!~/document.php', 'href="!~!~!~'.DOL_URL_ROOT.'/document.php', $content);
// Remove the protection tag !~!~!~
$content = str_replace('!~!~!~', '', $content);
dol_syslog('dolWebsiteReplacementOfLinks end', LOG_DEBUG);
//if ($contenttype == 'html') { print $content;exit; }
return $content;
}
/**
* Render a string of an HTML content and output it.
* Used to ouput the page when viewed from server (Dolibarr or Apache).
*
* @param string $content Content string
* @param string $content Content string
* @param string $contenttype Content type
* @param int $containerid Contenair id
* @return void
* @see dolWebsiteReplacementOfLinks() for function used to replace content in the backoffice context when USEDOLIBARREDITOR is not on
* @see dolWebsiteReplacementOfLinks() for function used to replace content in the backoffice context.
*/
function dolWebsiteOutput($content)
function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
{
global $db, $langs, $conf, $user;
global $dolibarr_main_url_root, $dolibarr_main_data_root;
dol_syslog("dolWebsiteOutput start (USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER')?'1':'')." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR')?'1':'').')');
dol_syslog("dolWebsiteOutput start (contenttype=".$contenttype." containerid=".$containerid." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR')?'1':'')." USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER')?'1':'').')');
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
@ -195,43 +228,66 @@ function dolWebsiteOutput($content)
if (defined('USEDOLIBARREDITOR')) // REPLACEMENT OF LINKS When page called from Dolibarr editor
{
// We remove the <head> part of content
$content = preg_replace('/<head>.*<\/head>/ims', '', $content);
$content = preg_replace('/^.*<body(\s[^>]*)*>/ims', '', $content);
$content = preg_replace('/<\/body(\s[^>]*)*>.*$/ims', '', $content);
if ($contenttype == 'html')
{
$content = preg_replace('/<head>.*<\/head>/ims', '', $content);
$content = preg_replace('/^.*<body(\s[^>]*)*>/ims', '', $content);
$content = preg_replace('/<\/body(\s[^>]*)*>.*$/ims', '', $content);
}
}
elseif (defined('USEDOLIBARRSERVER')) // REPLACEMENT OF LINKS When page called from Dolibarr server
{
global $website;
// Protect the link styles.css.php to any replacement that we make after.
$content = str_replace('href="styles.css.php', 'href="!~!~!~styles.css.php', $content);
$content = str_replace('href="http', 'href="!~!~!~http', $content);
$content = str_replace('href="//', 'href="!~!~!~//', $content);
$content = str_replace('src="viewimage.php', 'src="!~!~!~/viewimage.php', $content);
$content = str_replace('src="/viewimage.php', 'src="!~!~!~/viewimage.php', $content);
$content = str_replace('src="'.DOL_URL_ROOT.'/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content);
$content = str_replace('href="document.php', 'href="!~!~!~/document.php', $content);
$content = str_replace('href="/document.php', 'href="!~!~!~/document.php', $content);
$content = str_replace('href="'.DOL_URL_ROOT.'/document.php', 'href="!~!~!~'.DOL_URL_ROOT.'/document.php', $content);
// Replace relative link / with dolibarr URL: ...href="/"...
$content=preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'"', $content, -1, $nbrep);
// Replace relative link /xxx.php with dolibarr URL: ...href="....php"
$content=preg_replace('/(href=")\/?([^:\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
// Replace relative link /xxx with dolibarr URL: ...href="....php"
$content=preg_replace('/(href=")\/?([a-zA-Z0-9\-]+)(\")/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2\3', $content, -1, $nbrep);
$content=preg_replace('/(href=")\/?([a-zA-Z0-9\-]+)(\?)/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2\3', $content, -1, $nbrep);
$content = preg_replace('/(href=")\/\"/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'"', $content, -1, $nbrep);
// Replace relative link /xxx.php#aaa or /xxx.php with dolibarr URL: ...href="....php" (we discard param ?...)
$content = preg_replace('/(href=")\/?([^:\"\!]*)\.php(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2\3"', $content, -1, $nbrep);
// Replace relative link /xxx.php?a=b&c=d#aaa or /xxx.php?a=b&c=d with dolibarr URL
$content = preg_replace('/(href=")\/?([^:\"\!]*)\.php\?([^#\"<>]*)(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2&\3\4"', $content, -1, $nbrep);
// Replace relative link without .php like /xxx#aaa or /xxx with dolibarr URL: ...href="....php"
$content = preg_replace('/(href=")\/?([a-zA-Z0-9\-_#]+)(\"|\?)/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2\3', $content, -1, $nbrep);
// Fix relative link /document.php with correct URL after the DOL_URL_ROOT: href="/document.php?modulepart=" => href="/dolibarr/document.php?modulepart="
$content=preg_replace('/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
$content=preg_replace('/(src=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
$content = preg_replace('/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
$content = preg_replace('/(src=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
// Fix relative link /viewimage.php with correct URL after the DOL_URL_ROOT: href="/viewimage.php?modulepart=" => href="/dolibarr/viewimage.php?modulepart="
$content=preg_replace('/(href=")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
$content=preg_replace('/(src=")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
$content = preg_replace('/(href=")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
$content = preg_replace('/(src=")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
$content = preg_replace('/(url\(")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
// Fix relative link into medias with correct URL after the DOL_URL_ROOT: ../url("medias/
$content=preg_replace('/url\((["\']?)medias\//', 'url(\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
$content=preg_replace('/data-slide-bg=(["\']?)medias\//', 'data-slide-bg=\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
$content = preg_replace('/url\((["\']?)medias\//', 'url(\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
$content = preg_replace('/data-slide-bg=(["\']?)medias\//', 'data-slide-bg=\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
// <img src="medias/image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
$content = preg_replace('/(<img[^>]*src=")(medias\/)/', '\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
// <img src="medias/...image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
// <img src="...image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
$content = preg_replace('/(<img[^>]*src=")\/?medias\//', '\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
// <img src="image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
$content = preg_replace('/(<img[^>]*src=")(?!(http|\/?viewimage|'.preg_quote(DOL_URL_ROOT, '/').'\/viewimage))/', '\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
$content = preg_replace('/(<img[^>]*src=")\/?([^:\"\!]+)\"/', '\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=\2"', $content, -1, $nbrep);
// <img src="viewimage.php/modulepart=medias&file=image.png" => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png"
$content = preg_replace('/(<img[^>]*src=")(\/?viewimage\.php)/', '\1'.DOL_URL_ROOT.'/viewimage.php', $content, -1, $nbrep);
$content = preg_replace('/(<img[^>]*src=")(\/?viewimage\.php)/', '\1!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content, -1, $nbrep);
// action="newpage.php" => action="dolibarr/website/index.php?website=...&pageref=newpage
$content = preg_replace('/(action=")\/?([^:\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
$content = preg_replace('/(action=")\/?([^:\"]*)(\.php\")/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
// Fix relative URL
$content = str_replace('src="!~!~!~/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content);
$content = str_replace('href="!~!~!~/document.php', 'href="!~!~!~'.DOL_URL_ROOT.'/document.php', $content);
// Remove the protection tag !~!~!~
$content = str_replace('!~!~!~', '', $content);
}
else // REPLACEMENT OF LINKS When page called from virtual host
{
@ -244,7 +300,12 @@ function dolWebsiteOutput($content)
$nbrep=0;
if (! $symlinktomediaexists)
{
$content=preg_replace('/(<script[^>]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
// <img src="image.png... => <img src="medias/image.png...
$content=preg_replace('/(<img[^>]*src=")\/?image\//', '\1/wrapper.php?modulepart=medias&file=medias/image/', $content, -1, $nbrep);
$content=preg_replace('/(url\(["\']?)\/?image\//', '\1/wrapper.php?modulepart=medias&file=medias/image/', $content, -1, $nbrep);
$content=preg_replace('/(<script[^>]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
$content=preg_replace('/(<a[^>]*href=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
$content=preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
@ -255,20 +316,33 @@ function dolWebsiteOutput($content)
$content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)hashp=([^\)]*)(["\']?\))/', '\1/wrapper.php\2hashp\3\4', $content, -1, $nbrep);
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=mycompany([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=mycompany\3file=\4\5', $content, -1, $nbrep);
// If some links to documents or viewimage remains, we replace with wrapper
$content=preg_replace('/(<img[^>]*src=")\/?viewimage\.php/', '\1/wrapper.php', $content, -1, $nbrep);
$content=preg_replace('/(<a[^>]*href=")\/?documents\.php/', '\1/wrapper.php', $content, -1, $nbrep);
}
else
{
$content=preg_replace('/(<script[^>]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1medias/\4\5', $content, -1, $nbrep);
// <img src="image.png... => <img src="medias/image.png...
$content=preg_replace('/(<img[^>]*src=")\/?image\//', '\1/medias/image/', $content, -1, $nbrep);
$content=preg_replace('/(url\(["\']?)\/?image\//', '\1/medias/image/', $content, -1, $nbrep);
$content=preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1medias/\4\5', $content, -1, $nbrep);
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1medias/\4\5', $content, -1, $nbrep);
$content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1medias/\4\5', $content, -1, $nbrep);
$content=preg_replace('/(<script[^>]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/medias/\4\5', $content, -1, $nbrep);
$content=preg_replace('/(<a[^>]*href=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/medias/\4\5', $content, -1, $nbrep);
$content=preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/medias/\4\5', $content, -1, $nbrep);
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/medias/\4\5', $content, -1, $nbrep);
$content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1/medias/\4\5', $content, -1, $nbrep);
$content=preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
$content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)hashp=([^\)]*)(["\']?\))/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=mycompany([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=mycompany\3file=\4\5', $content, -1, $nbrep);
// If some links to documents or viewimage remains, we replace with wrapper
$content=preg_replace('/(<img[^>]*src=")\/?viewimage\.php/', '\1/wrapper.php', $content, -1, $nbrep);
$content=preg_replace('/(<a[^>]*href=")\/?document\.php/', '\1/wrapper.php', $content, -1, $nbrep);
}
}
@ -285,7 +359,7 @@ function dolWebsiteOutput($content)
*
* @param string $content Content string
* @return void
* @see dolWebsiteOutput
* @see dolWebsiteOutput()
*/
/*
function dolWebsiteSaveContent($content)
@ -342,9 +416,9 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri
if (defined('USEDOLIBARREDITOR'))
{
print '<div class="margintoponly marginleftonly">';
print "This page contains dynamic code that make a redirect to '".$containerref."' in your current context. There is no preview for this page.";
print "This page contains dynamic code that make a redirect to '".$containerref."' in your current context. Redirect has been canceled as it is not supported in edition mode.";
print '</div>';
exit;
return;
}
if (defined('USEDOLIBARRSERVER')) // When page called from Dolibarr server
@ -452,8 +526,6 @@ function includeContainer($containerref)
function getStructuredData($type, $data = array())
{
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
global $includehtmlcontentopened;
global $websitekey, $websitepagefile;
if ($type == 'software')
{
@ -561,6 +633,108 @@ function getStructuredData($type, $data = array())
return $ret;
}
/**
* Return list of containers object that match a criteria
*
* @param string $type Type of container to search into (Example: 'page')
* @param string $algo Algorithm used for search (Example: 'meta' is searching into meta information like title and description, 'metacontent')
* @param string $searchstring Search string
* @param int $max Max number of answers
* @return string HTML content
*/
function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25)
{
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
$error = 0;
$arrayresult = array('code'=>'', 'list'=>array());
if (! is_object($weblangs)) $weblangs = $langs;
if (empty($searchstring))
{
$error++;
$arrayresult['code']='KO';
$arrayresult['message']=$weblangs->trans("EmptySearchString");
}
elseif (dol_strlen($searchstring) < 2)
{
$weblangs->load("errors");
$error++;
$arrayresult['code']='KO';
$arrayresult['message']=$weblangs->trans("ErrorSearchCriteriaTooSmall");
}
elseif (! in_array($type, array('', 'page')))
{
$error++;
$arrayresult['code']='KO';
$arrayresult['message']='Bad value for parameter $type';
}
$searchdone = 0;
if (! $error && in_array($algo, array('meta', 'metacontent', 'content')))
{
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'website_page';
$sql.= " WHERE fk_website = ".$website->id;
if ($type) $sql.= " AND type_container = '".$db->escape($type)."'";
$sql.= " AND (";
$searchalgo = '';
if ($algo == 'meta' || $algo == 'metacontent')
{
$searchalgo.= ($searchalgo?' OR ':'')."title LIKE '%".$db->escape($searchstring)."%' OR description LIKE '%".$db->escape($searchstring)."%'";
$searchalgo.= ($searchalgo?' OR ':'')."keywords LIKE '".$db->escape($searchstring).",%' OR keywords LIKE '% ".$db->escape($searchstring)."%'"; // TODO Use a better way to scan keywords
}
if ($algo == 'metacontent' || $algo == 'content')
{
$searchalgo.= ($searchalgo?' OR ':'')."content LIKE '%".$db->escape($searchstring)."%'";
}
$sql.=$searchalgo;
$sql.= ")";
$sql.= $db->plimit($max);
$resql = $db->query($sql);
if ($resql)
{
$i = 0;
while (($obj = $db->fetch_object($resql)) && ($i < $max || $max == 0))
{
if ($obj->rowid > 0)
{
$tmpwebsitepage = new WebsitePage($db);
$tmpwebsitepage->fetch($obj->rowid);
if ($tmpwebsitepage->id > 0) $arrayresult['list'][]=$tmpwebsitepage;
}
$i++;
}
$arrayresult['code']='OK';
if (empty($arrayresult['list']))
{
$arrayresult['code']='KO';
$arrayresult['message']=$weblangs->trans("NoRecordFound");
}
}
else
{
$error++;
$arrayresult['code']=$db->lasterrno();
$arrayresult['message']=$db->lasterror();
}
$searchdone = 1;
}
if (! $searchdone)
{
$error++;
$arrayresult['code']='KO';
$arrayresult['message']='No supported algorithm found';
}
return $arrayresult;
}
/**
* Download all images found into page content $tmp.
* If $modifylinks is set, links to images will be replace with a link to viewimage wrapper.
@ -744,313 +918,3 @@ function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modify
}
}
}
/**
* Save content of a page on disk
*
* @param string $filemaster Full path of filename master.inc.php for website to generate
* @return boolean True if OK
*/
function dolSaveMasterFile($filemaster)
{
global $conf;
// Now generate the master.inc.php page
dol_syslog("We regenerate the master file");
dol_delete_file($filemaster);
$mastercontent = '<?php'."\n";
$mastercontent.= '// File generated to link to the master file - DO NOT MODIFY - It is just an include'."\n";
$mastercontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
$mastercontent.= '?>'."\n";
$result = file_put_contents($filemaster, $mastercontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filemaster, octdec($conf->global->MAIN_UMASK));
return $result;
}
/**
* Save content of a page on disk
*
* @param string $filealias Full path of filename to generate
* @param Website $object Object website
* @param WebsitePage $objectpage Object websitepage
* @return boolean True if OK
*/
function dolSavePageAlias($filealias, $object, $objectpage)
{
global $conf;
// Now create the .tpl file (duplicate code with actions updatesource or updatecontent but we need this to save new header)
dol_syslog("We regenerate the alias page filealias=".$filealias);
$aliascontent = '<?php'."\n";
$aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";
$aliascontent.= 'global $dolibarr_main_data_root;'."\n";
$aliascontent.= 'if (empty($dolibarr_main_data_root)) require \'./page'.$objectpage->id.'.tpl.php\'; ';
$aliascontent.= 'else require $dolibarr_main_data_root.\'/website/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n";
$aliascontent.= '?>'."\n";
$result = file_put_contents($filealias, $aliascontent);
if (! empty($conf->global->MAIN_UMASK)) {
@chmod($filealias, octdec($conf->global->MAIN_UMASK));
}
return ($result?true:false);
}
/**
* Save content of a page on disk
*
* @param string $filetpl Full path of filename to generate
* @param Website $object Object website
* @param WebsitePage $objectpage Object websitepage
* @return boolean True if OK
*/
function dolSavePageContent($filetpl, $object, $objectpage)
{
global $conf;
// Now create the .tpl file (duplicate code with actions updatesource or updatecontent but we need this to save new header)
dol_syslog("We regenerate the tpl page filetpl=".$filetpl);
dol_delete_file($filetpl);
$shortlangcode = '';
if ($objectpage->lang) $shortlangcode=preg_replace('/[_-].*$/', '', $objectpage->lang); // en_US or en-US -> en
$tplcontent ='';
$tplcontent.= "<?php // BEGIN PHP\n";
$tplcontent.= '$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n";
$tplcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$tplcontent.= "ob_start();\n";
$tplcontent.= "// END PHP ?>\n";
if (! empty($conf->global->WEBSITE_FORCE_DOCTYPE_HTML5))
{
$tplcontent.= "<!DOCTYPE html>\n";
}
$tplcontent.= '<html'.($shortlangcode ? ' lang="'.$shortlangcode.'"':'').'>'."\n";
$tplcontent.= '<head>'."\n";
$tplcontent.= '<title>'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'</title>'."\n";
$tplcontent.= '<meta charset="UTF-8">'."\n";
$tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
$tplcontent.= '<meta name="robots" content="index, follow" />'."\n";
$tplcontent.= '<meta name="viewport" content="width=device-width, initial-scale=1.0">'."\n";
$tplcontent.= '<meta name="keywords" content="'.dol_string_nohtmltag($objectpage->keywords).'" />'."\n";
$tplcontent.= '<meta name="title" content="'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'" />'."\n";
$tplcontent.= '<meta name="description" content="'.dol_string_nohtmltag($objectpage->description, 0, 'UTF-8').'" />'."\n";
$tplcontent.= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.' '.DOL_VERSION.' (https://www.dolibarr.org)" />'."\n";
$tplcontent.= '<meta name="dolibarr:pageid" content="'.dol_string_nohtmltag($objectpage->id).'" />'."\n";
$tplcontent.= '<link href="/'.(($objectpage->id == $object->fk_default_home) ? '' : ($objectpage->pageurl.'.php')).'" rel="canonical" />'."\n";
$tplcontent.= '<!-- Include link to CSS file -->'."\n";
$tplcontent.= '<link rel="stylesheet" href="styles.css.php?website=<?php echo $websitekey; ?>" type="text/css" />'."\n";
$tplcontent.= '<!-- Include HTML header from common file -->'."\n";
$tplcontent.= '<?php print preg_replace(\'/<\/?html>/ims\', \'\', file_get_contents(DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html")); ?>'."\n";
$tplcontent.= '<!-- Include HTML header from page header block -->'."\n";
$tplcontent.= preg_replace('/<\/?html>/ims', '', $objectpage->htmlheader)."\n";
$tplcontent.= '</head>'."\n";
$tplcontent.= '<!-- File generated by Dolibarr website module editor -->'."\n";
$tplcontent.= '<body id="bodywebsite" class="bodywebsite">'."\n";
$tplcontent.= $objectpage->content."\n";
$tplcontent.= '</body>'."\n";
$tplcontent.= '</html>'."\n";
$tplcontent.= '<?php // BEGIN PHP'."\n";
$tplcontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
$tplcontent.= "// END PHP ?>"."\n";
//var_dump($filetpl);exit;
$result = file_put_contents($filetpl, $tplcontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filetpl, octdec($conf->global->MAIN_UMASK));
return $result;
}
/**
* Save content of the index.php and wrapper.php page
*
* @param string $pathofwebsite Path of website root
* @param string $fileindex Full path of file index.php
* @param string $filetpl File tpl to index.php page redirect to
* @param string $filewrapper Full path of file wrapper.php
* @return boolean True if OK
*/
function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper)
{
global $conf;
$result1=false;
$result2=false;
dol_mkdir($pathofwebsite);
dol_delete_file($fileindex);
$indexcontent = '<?php'."\n";
$indexcontent.= "// BEGIN PHP File generated to provide an index.php as Home Page or alias redirector - DO NOT MODIFY - It is just a generated wrapper.\n";
$indexcontent.= '$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n";
$indexcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
$indexcontent.= 'if (! empty($_GET[\'pageref\']) || ! empty($_GET[\'pagealiasalt\']) || ! empty($_GET[\'pageid\'])) {'."\n";
$indexcontent.= " require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$indexcontent.= " require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$indexcontent.= ' redirectToContainer($_GET[\'pageref\'], $_GET[\'pagealiasalt\'], $_GET[\'pageid\']);'."\n";
$indexcontent.= "}\n";
$indexcontent.= "include_once './".basename($filetpl)."'\n";
$indexcontent.= '// END PHP ?>'."\n";
$result1 = file_put_contents($fileindex, $indexcontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($fileindex, octdec($conf->global->MAIN_UMASK));
dol_delete_file($filewrapper);
$wrappercontent=file_get_contents(DOL_DOCUMENT_ROOT.'/website/samples/wrapper.html');
$result2 = file_put_contents($filewrapper, $wrappercontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filewrapper, octdec($conf->global->MAIN_UMASK));
return ($result1 && $result2);
}
/**
* Save content of a page on disk
*
* @param string $filehtmlheader Full path of filename to generate
* @param string $htmlheadercontent Content of file
* @return boolean True if OK
*/
function dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent)
{
global $conf, $pathofwebsite;
dol_syslog("Save html header into ".$filehtmlheader);
dol_mkdir($pathofwebsite);
$result = file_put_contents($filehtmlheader, $htmlheadercontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filehtmlheader, octdec($conf->global->MAIN_UMASK));
if (! $result)
{
setEventMessages('Failed to write file '.$filehtmlheader, null, 'errors');
return false;
}
return true;
}
/**
* Save content of a page on disk
*
* @param string $filecss Full path of filename to generate
* @param string $csscontent Content of file
* @return boolean True if OK
*/
function dolSaveCssFile($filecss, $csscontent)
{
global $conf, $pathofwebsite;
dol_syslog("Save css file into ".$filecss);
dol_mkdir($pathofwebsite);
$result = file_put_contents($filecss, $csscontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filecss, octdec($conf->global->MAIN_UMASK));
if (! $result)
{
setEventMessages('Failed to write file '.$filecss, null, 'errors');
return false;
}
return true;
}
/**
* Save content of a page on disk
*
* @param string $filejs Full path of filename to generate
* @param string $jscontent Content of file
* @return boolean True if OK
*/
function dolSaveJsFile($filejs, $jscontent)
{
global $conf, $pathofwebsite;
dol_syslog("Save js file into ".$filejs);
dol_mkdir($pathofwebsite);
$result = file_put_contents($filejs, $jscontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filejs, octdec($conf->global->MAIN_UMASK));
if (! $result)
{
setEventMessages('Failed to write file '.$filejs, null, 'errors');
return false;
}
return true;
}
/**
* Save content of a page on disk
*
* @param string $filerobot Full path of filename to generate
* @param string $robotcontent Content of file
* @return boolean True if OK
*/
function dolSaveRobotFile($filerobot, $robotcontent)
{
global $conf, $pathofwebsite;
dol_syslog("Save robot file into ".$filerobot);
dol_mkdir($pathofwebsite);
$result = file_put_contents($filerobot, $robotcontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filerobot, octdec($conf->global->MAIN_UMASK));
if (! $result)
{
setEventMessages('Failed to write file '.$filerobot, null, 'errors');
return false;
}
return true;
}
/**
* Save content of a page on disk
*
* @param string $filehtaccess Full path of filename to generate
* @param string $htaccess Content of file
* @return boolean True if OK
*/
function dolSaveHtaccessFile($filehtaccess, $htaccess)
{
global $conf, $pathofwebsite;
dol_syslog("Save htaccess file into ".$filehtaccess);
dol_mkdir($pathofwebsite);
$result = file_put_contents($filehtaccess, $htaccess);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filehtaccess, octdec($conf->global->MAIN_UMASK));
if (! $result)
{
setEventMessages('Failed to write file '.$filehtaccess, null, 'errors');
return false;
}
return true;
}

View File

@ -0,0 +1,455 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/lib/website2.lib.php
* \ingroup website
* \brief Library for website module (rare functions not required for execution of website)
*/
/**
* Save content of a page on disk
*
* @param string $filemaster Full path of filename master.inc.php for website to generate
* @return boolean True if OK
*/
function dolSaveMasterFile($filemaster)
{
global $conf;
// Now generate the master.inc.php page
dol_syslog("We regenerate the master file");
dol_delete_file($filemaster);
$mastercontent = '<?php'."\n";
$mastercontent.= '// File generated to link to the master file - DO NOT MODIFY - It is just an include'."\n";
$mastercontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
$mastercontent.= '?>'."\n";
$result = file_put_contents($filemaster, $mastercontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filemaster, octdec($conf->global->MAIN_UMASK));
return $result;
}
/**
* Save content of a page on disk
*
* @param string $filealias Full path of filename to generate
* @param Website $object Object website
* @param WebsitePage $objectpage Object websitepage
* @return boolean True if OK
*/
function dolSavePageAlias($filealias, $object, $objectpage)
{
global $conf;
// Now create the .tpl file (duplicate code with actions updatesource or updatecontent but we need this to save new header)
dol_syslog("dolSavePageAlias We regenerate the alias page filealias=".$filealias);
$aliascontent = '<?php'."\n";
$aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";
$aliascontent.= 'global $dolibarr_main_data_root;'."\n";
$aliascontent.= 'if (empty($dolibarr_main_data_root)) require \'./page'.$objectpage->id.'.tpl.php\'; ';
$aliascontent.= 'else require $dolibarr_main_data_root.\'/website/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n";
$aliascontent.= '?>'."\n";
$result = file_put_contents($filealias, $aliascontent);
if (! empty($conf->global->MAIN_UMASK)) {
@chmod($filealias, octdec($conf->global->MAIN_UMASK));
}
return ($result?true:false);
}
/**
* Save content of a page on disk
*
* @param string $filetpl Full path of filename to generate
* @param Website $object Object website
* @param WebsitePage $objectpage Object websitepage
* @return boolean True if OK
*/
function dolSavePageContent($filetpl, $object, $objectpage)
{
global $conf;
// Now create the .tpl file (duplicate code with actions updatesource or updatecontent but we need this to save new header)
dol_syslog("We regenerate the tpl page filetpl=".$filetpl);
dol_delete_file($filetpl);
$shortlangcode = '';
if ($objectpage->lang) $shortlangcode=preg_replace('/[_-].*$/', '', $objectpage->lang); // en_US or en-US -> en
$tplcontent ='';
$tplcontent.= "<?php // BEGIN PHP\n";
$tplcontent.= '$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n";
$tplcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$tplcontent.= "ob_start();\n";
$tplcontent.= "// END PHP ?>\n";
if (! empty($conf->global->WEBSITE_FORCE_DOCTYPE_HTML5))
{
$tplcontent.= "<!DOCTYPE html>\n";
}
$tplcontent.= '<html'.($shortlangcode ? ' lang="'.$shortlangcode.'"':'').'>'."\n";
$tplcontent.= '<head>'."\n";
$tplcontent.= '<title>'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'</title>'."\n";
$tplcontent.= '<meta charset="utf-8">'."\n";
$tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
$tplcontent.= '<meta name="robots" content="index, follow" />'."\n";
$tplcontent.= '<meta name="viewport" content="width=device-width, initial-scale=1.0">'."\n";
$tplcontent.= '<meta name="keywords" content="'.dol_string_nohtmltag($objectpage->keywords).'" />'."\n";
$tplcontent.= '<meta name="title" content="'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'" />'."\n";
$tplcontent.= '<meta name="description" content="'.dol_string_nohtmltag($objectpage->description, 0, 'UTF-8').'" />'."\n";
$tplcontent.= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.' '.DOL_VERSION.' (https://www.dolibarr.org)" />'."\n";
$tplcontent.= '<meta name="dolibarr:pageid" content="'.dol_string_nohtmltag($objectpage->id).'" />'."\n";
$tplcontent.= '<link href="/'.(($objectpage->id == $object->fk_default_home) ? '' : ($objectpage->pageurl.'.php')).'" rel="canonical" />'."\n";
$tplcontent.= '<!-- Include link to CSS file -->'."\n";
$tplcontent.= '<link rel="stylesheet" href="styles.css.php?website=<?php echo $websitekey; ?>" type="text/css" />'."\n";
$tplcontent.= '<!-- Include HTML header from common file -->'."\n";
$tplcontent.= '<?php print preg_replace(\'/<\/?html>/ims\', \'\', file_get_contents(DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html")); ?>'."\n";
$tplcontent.= '<!-- Include HTML header from page header block -->'."\n";
$tplcontent.= preg_replace('/<\/?html>/ims', '', $objectpage->htmlheader)."\n";
$tplcontent.= '</head>'."\n";
$tplcontent.= '<!-- File generated by Dolibarr website module editor -->'."\n";
$tplcontent.= '<body id="bodywebsite" class="bodywebsite">'."\n";
$tplcontent.= $objectpage->content."\n";
$tplcontent.= '</body>'."\n";
$tplcontent.= '</html>'."\n";
$tplcontent.= '<?php // BEGIN PHP'."\n";
$tplcontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp, "html", '.$objectpage->id.');'."\n";
$tplcontent.= "// END PHP ?>"."\n";
//var_dump($filetpl);exit;
$result = file_put_contents($filetpl, $tplcontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filetpl, octdec($conf->global->MAIN_UMASK));
return $result;
}
/**
* Save content of the index.php and wrapper.php page
*
* @param string $pathofwebsite Path of website root
* @param string $fileindex Full path of file index.php
* @param string $filetpl File tpl to index.php page redirect to
* @param string $filewrapper Full path of file wrapper.php
* @return boolean True if OK
*/
function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper)
{
global $conf;
$result1=false;
$result2=false;
dol_mkdir($pathofwebsite);
dol_delete_file($fileindex);
$indexcontent = '<?php'."\n";
$indexcontent.= "// BEGIN PHP File generated to provide an index.php as Home Page or alias redirector - DO NOT MODIFY - It is just a generated wrapper.\n";
$indexcontent.= '$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n";
$indexcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
$indexcontent.= 'if (! empty($_GET[\'pageref\']) || ! empty($_GET[\'pagealiasalt\']) || ! empty($_GET[\'pageid\'])) {'."\n";
$indexcontent.= " require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$indexcontent.= " require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$indexcontent.= ' redirectToContainer($_GET[\'pageref\'], $_GET[\'pagealiasalt\'], $_GET[\'pageid\']);'."\n";
$indexcontent.= "}\n";
$indexcontent.= "include_once './".basename($filetpl)."'\n";
$indexcontent.= '// END PHP ?>'."\n";
$result1 = file_put_contents($fileindex, $indexcontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($fileindex, octdec($conf->global->MAIN_UMASK));
dol_delete_file($filewrapper);
$wrappercontent=file_get_contents(DOL_DOCUMENT_ROOT.'/website/samples/wrapper.html');
$result2 = file_put_contents($filewrapper, $wrappercontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filewrapper, octdec($conf->global->MAIN_UMASK));
return ($result1 && $result2);
}
/**
* Save content of a page on disk
*
* @param string $filehtmlheader Full path of filename to generate
* @param string $htmlheadercontent Content of file
* @return boolean True if OK
*/
function dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent)
{
global $conf, $pathofwebsite;
dol_syslog("Save html header into ".$filehtmlheader);
dol_mkdir($pathofwebsite);
$result = file_put_contents($filehtmlheader, $htmlheadercontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filehtmlheader, octdec($conf->global->MAIN_UMASK));
return $result;
}
/**
* Save content of a page on disk
*
* @param string $filecss Full path of filename to generate
* @param string $csscontent Content of file
* @return boolean True if OK
*/
function dolSaveCssFile($filecss, $csscontent)
{
global $conf, $pathofwebsite;
dol_syslog("Save css file into ".$filecss);
dol_mkdir($pathofwebsite);
$result = file_put_contents($filecss, $csscontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filecss, octdec($conf->global->MAIN_UMASK));
return $result;
}
/**
* Save content of a page on disk
*
* @param string $filejs Full path of filename to generate
* @param string $jscontent Content of file
* @return boolean True if OK
*/
function dolSaveJsFile($filejs, $jscontent)
{
global $conf, $pathofwebsite;
dol_syslog("Save js file into ".$filejs);
dol_mkdir($pathofwebsite);
$result = file_put_contents($filejs, $jscontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filejs, octdec($conf->global->MAIN_UMASK));
return $result;
}
/**
* Save content of a page on disk
*
* @param string $filerobot Full path of filename to generate
* @param string $robotcontent Content of file
* @return boolean True if OK
*/
function dolSaveRobotFile($filerobot, $robotcontent)
{
global $conf, $pathofwebsite;
dol_syslog("Save robot file into ".$filerobot);
dol_mkdir($pathofwebsite);
$result = file_put_contents($filerobot, $robotcontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filerobot, octdec($conf->global->MAIN_UMASK));
return $result;
}
/**
* Save content of a page on disk
*
* @param string $filehtaccess Full path of filename to generate
* @param string $htaccess Content of file
* @return boolean True if OK
*/
function dolSaveHtaccessFile($filehtaccess, $htaccess)
{
global $conf, $pathofwebsite;
dol_syslog("Save htaccess file into ".$filehtaccess);
dol_mkdir($pathofwebsite);
$result = file_put_contents($filehtaccess, $htaccess);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filehtaccess, octdec($conf->global->MAIN_UMASK));
return $result;
}
/**
* Save content of a page on disk
*
* @param string $file Full path of filename to generate
* @param string $content Content of file
* @return boolean True if OK
*/
function dolSaveManifestJson($file, $content)
{
global $conf, $pathofwebsite;
dol_syslog("Save manifest.js.php file into ".$file);
dol_mkdir($pathofwebsite);
$result = file_put_contents($file, $content);
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
return $result;
}
/**
* Save content of a page on disk
*
* @param string $file Full path of filename to generate
* @param string $content Content of file
* @return boolean True if OK
*/
function dolSaveReadme($file, $content)
{
global $conf, $pathofwebsite;
dol_syslog("Save README.md file into ".$file);
dol_mkdir($pathofwebsite);
$result = file_put_contents($file, $content);
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
return $result;
}
/**
* Show list of themes. Show all thumbs of themes/skins
*
* @param Website $website Object website to load the tempalte into
* @return void
*/
function showWebsiteTemplates(Website $website)
{
global $conf,$langs,$db,$form;
global $bc;
$dirthemes=array('/doctemplates/websites');
if (! empty($conf->modules_parts['websitetemplates'])) // Using this feature slow down application
{
foreach($conf->modules_parts['websitetemplates'] as $reldir)
{
$dirthemes=array_merge($dirthemes, (array) ($reldir.'doctemplates/websites'));
}
}
$dirthemes=array_unique($dirthemes);
// Now dir_themes=array('/themes') or dir_themes=array('/theme','/mymodule/theme')
$colspan=2;
$thumbsbyrow=6;
print '<table class="noborder" width="100%">';
// Title
print '<tr class="liste_titre"><th class="titlefield"></th>';
print '<th class="right">';
$url='https://www.dolistore.com/43-web-site-templates';
print '<a href="'.$url.'" target="_blank">';
print $langs->trans('DownloadMoreSkins');
print '</a>';
print '</th></tr>';
print '<tr>';
print '<td>'.$langs->trans("ThemeDir").'</td>';
print '<td>';
foreach($dirthemes as $dirtheme)
{
echo '"'.$dirtheme.'" ';
}
print '</td>';
print '</tr>';
print '<tr><td colspan="'.$colspan.'">';
print '<table class="nobordernopadding" width="100%"><tr><td><div class="center">';
$i=0;
foreach($dirthemes as $dir)
{
//print $dirroot.$dir;exit;
$dirtheme=DOL_DATA_ROOT.$dir; // This include loop on $conf->file->dol_document_root
if (is_dir($dirtheme))
{
$handle=opendir($dirtheme);
if (is_resource($handle))
{
while (($subdir = readdir($handle))!==false)
{
if (is_file($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.'
&& substr($subdir, 0, 3) <> 'CVS' && preg_match('/\.zip$/i', $subdir))
{
$subdirwithoutzip = preg_replace('/\.zip$/i', '', $subdir);
// Disable not stable themes (dir ends with _exp or _dev)
if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i', $subdir)) continue;
if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i', $subdir)) continue;
print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
$file = $dirtheme."/".$subdirwithoutzip.".jpg";
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=doctemplateswebsite&file='.$subdirwithoutzip.".jpg";
if (! file_exists($file)) $url=DOL_URL_ROOT.'/public/theme/common/nophoto.png';
$originalfile = basename($file);
$entity = $conf->entity;
$modulepart = 'doctemplateswebsite';
$cache = '';
$title = $file;
$ret='';
$urladvanced=getAdvancedPreviewUrl($modulepart, $originalfile, 1, '&entity='.$entity);
if (! empty($urladvanced)) $ret.='<a class="'.$urladvanced['css'].'" target="'.$urladvanced['target'].'" mime="'.$urladvanced['mime'].'" href="'.$urladvanced['url'].'">';
else $ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
print $ret;
print '<img class="websiteskinthumb shadow" src="'.$url.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'" style="margin-bottom: 5px;">';
print '</a>';
print '<br>';
print $subdir.' ('.dol_print_size(dol_filesize($dirtheme."/".$subdir), 1, 1).')';
print '<br><a href="'.$_SERVER["PHP_SELF"].'?action=importsiteconfirm&website='.$website->ref.'&templateuserfile='.$subdir.'" class="button">'.$langs->trans("Load").'</a>';
print '</div>';
$i++;
}
}
}
}
}
print '</div></td></tr></table>';
print '</td></tr>';
print '</table>';
}

View File

@ -376,7 +376,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -386,7 +386,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
* @param int $hidefreetext 1=Hide free text
* @return void
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);

View File

@ -244,7 +244,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
}
}
$dir = $conf->commande->dir_output;
$dir = $conf->commande->multidir_output[$object->entity];
$objectref = dol_sanitizeFileName($object->ref);
if (! preg_match('/specimen/i', $objectref)) $dir.= "/" . $objectref;
$file = $dir . "/" . $objectref . ".odt";

View File

@ -239,13 +239,13 @@ class pdf_einstein extends ModelePDFCommandes
// Definition of $dir and $file
if ($object->specimen)
{
$dir = $conf->commande->dir_output;
$dir = $conf->commande->multidir_output[$conf->entity];
$file = $dir . "/SPECIMEN.pdf";
}
else
{
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->commande->dir_output . "/" . $objectref;
$dir = $conf->commande->multidir_output[$object->entity] . "/" . $objectref;
$file = $dir . "/" . $objectref . ".pdf";
}
@ -290,7 +290,7 @@ class pdf_einstein extends ModelePDFCommandes
// Set path to the background PDF File
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}
@ -648,6 +648,7 @@ class pdf_einstein extends ModelePDFCommandes
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show payments table
@ -658,12 +659,12 @@ class pdf_einstein extends ModelePDFCommandes
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
*/
private function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show miscellaneous information (payment mode, payment term, ...)
@ -674,7 +675,7 @@ class pdf_einstein extends ModelePDFCommandes
* @param Translate $outputlangs Langs object
* @return void
*/
private function _tableau_info(&$pdf, $object, $posy, $outputlangs)
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
@ -850,7 +851,7 @@ class pdf_einstein extends ModelePDFCommandes
return $posy;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show total to pay
@ -862,7 +863,7 @@ class pdf_einstein extends ModelePDFCommandes
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@ -1112,6 +1113,7 @@ class pdf_einstein extends ModelePDFCommandes
return ($tab2_top + ($tab2_hl * $index));
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -1125,7 +1127,7 @@ class pdf_einstein extends ModelePDFCommandes
* @param string $currency Currency code
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@ -1227,7 +1229,7 @@ class pdf_einstein extends ModelePDFCommandes
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param string $titlekey Translation key to show as title of document
* @return void
* @return int Return topshift value
*/
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "PdfOrderTitle")
{
@ -1258,7 +1260,7 @@ class pdf_einstein extends ModelePDFCommandes
// Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{
if (is_readable($logo))

View File

@ -281,13 +281,13 @@ class pdf_eratosthene extends ModelePDFCommandes
// Definition of $dir and $file
if ($object->specimen)
{
$dir = $conf->commande->dir_output;
$dir = $conf->commande->multidir_output[$conf->entity];
$file = $dir . "/SPECIMEN.pdf";
}
else
{
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->commande->dir_output . "/" . $objectref;
$dir = $conf->commande->multidir_output[$object->entity] . "/" . $objectref;
$file = $dir . "/" . $objectref . ".pdf";
}
@ -331,7 +331,7 @@ class pdf_eratosthene extends ModelePDFCommandes
// Set path to the background PDF File
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}
@ -855,7 +855,7 @@ class pdf_eratosthene extends ModelePDFCommandes
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
*/
private function drawPaymentsTable(&$pdf, $object, $posy, $outputlangs)
protected function drawPaymentsTable(&$pdf, $object, $posy, $outputlangs)
{
}
@ -868,7 +868,7 @@ class pdf_eratosthene extends ModelePDFCommandes
* @param Translate $outputlangs Langs object
* @return void
*/
private function drawInfoTable(&$pdf, $object, $posy, $outputlangs)
protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs)
{
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@ -1054,7 +1054,7 @@ class pdf_eratosthene extends ModelePDFCommandes
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
private function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs)
protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
global $conf,$mysoc;
@ -1300,6 +1300,7 @@ class pdf_eratosthene extends ModelePDFCommandes
return ($tab2_top + ($tab2_hl * $index));
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -1313,7 +1314,7 @@ class pdf_eratosthene extends ModelePDFCommandes
* @param string $currency Currency code
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@ -1393,7 +1394,7 @@ class pdf_eratosthene extends ModelePDFCommandes
// Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{
if (is_readable($logo))

View File

@ -67,13 +67,13 @@ class pdf_proforma extends pdf_einstein
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param string $titlekey Translation key to show as title of document
* @return void
* @return int Return topshift value
*/
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "InvoiceProForma")
{
// phpcs:enable
global $conf,$langs,$hookmanager;
parent::_pagehead($pdf, $object, $showaddress, $outputlangs, $titlekey);
return parent::_pagehead($pdf, $object, $showaddress, $outputlangs, $titlekey);
}
}

View File

@ -121,7 +121,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."commande";
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity;
$sql.= " AND entity IN (".getEntity('ordernumber', 1, $object).")";
$resql=$db->query($sql);
if ($resql)

View File

@ -137,9 +137,12 @@ class mod_commande_saphir extends ModeleNumRefCommandes
return 0;
}
// Get entities
$entity = getEntity('ordernumber', 1, $object);
$date = ($object->date_commande ? $object->date_commande : $object->date);
$numFinal=get_next_value($db, $mask, 'commande', 'ref', '', $objsoc, $date);
$numFinal=get_next_value($db, $mask, 'commande', 'ref', '', $objsoc, $date, 'next', false, null, $entity);
return $numFinal;
}

View File

@ -507,6 +507,7 @@ class pdf_strato extends ModelePDFContract
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -519,7 +520,7 @@ class pdf_strato extends ModelePDFContract
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf;
@ -566,7 +567,7 @@ class pdf_strato extends ModelePDFContract
* @param Translate $outputlangs Object language for output
* @return void
*/
private function tabSignature(&$pdf, $tab_top, $tab_height, $outputlangs)
protected function tabSignature(&$pdf, $tab_top, $tab_height, $outputlangs)
{
$pdf->SetDrawColor(128, 128, 128);
$posmiddle = $this->marge_gauche + round(($this->page_largeur - $this->marge_gauche - $this->marge_droite)/2);
@ -585,6 +586,7 @@ class pdf_strato extends ModelePDFContract
$pdf->MultiCell($this->page_largeur-$this->marge_droite - $posmiddle - 5, 20, '', 1);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -594,7 +596,7 @@ class pdf_strato extends ModelePDFContract
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf,$langs;
@ -764,6 +766,7 @@ class pdf_strato extends ModelePDFContract
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -773,7 +776,7 @@ class pdf_strato extends ModelePDFContract
* @param int $hidefreetext 1=Hide free text
* @return integer
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -648,6 +648,7 @@ class pdf_espadon extends ModelePdfExpedition
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show total to pay
@ -659,7 +660,7 @@ class pdf_espadon extends ModelePdfExpedition
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@ -749,6 +750,7 @@ class pdf_espadon extends ModelePdfExpedition
return ($tab2_top + ($tab2_hl * $index));
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -761,7 +763,7 @@ class pdf_espadon extends ModelePdfExpedition
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf;
@ -796,6 +798,7 @@ class pdf_espadon extends ModelePdfExpedition
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -805,7 +808,7 @@ class pdf_espadon extends ModelePdfExpedition
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf,$langs,$mysoc;
@ -1044,6 +1047,7 @@ class pdf_espadon extends ModelePdfExpedition
$pdf->SetTextColor(0, 0, 0);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -1053,7 +1057,7 @@ class pdf_espadon extends ModelePdfExpedition
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -448,6 +448,7 @@ class pdf_merou extends ModelePdfExpedition
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -460,7 +461,7 @@ class pdf_merou extends ModelePdfExpedition
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $langs;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@ -489,6 +490,7 @@ class pdf_merou extends ModelePdfExpedition
$pdf->Rect(10, $tab_top, 190, $tab_height);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -498,7 +500,7 @@ class pdf_merou extends ModelePdfExpedition
* @param int $hidefreetext 1=Hide free text
* @return void
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('', '', $default_font_size - 2);
@ -517,7 +519,7 @@ class pdf_merou extends ModelePdfExpedition
//}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -527,7 +529,7 @@ class pdf_merou extends ModelePdfExpedition
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf, $langs,$hookmanager;

View File

@ -664,6 +664,7 @@ class pdf_rouget extends ModelePdfExpedition
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show total to pay
@ -675,7 +676,7 @@ class pdf_rouget extends ModelePdfExpedition
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@ -771,6 +772,7 @@ class pdf_rouget extends ModelePdfExpedition
return ($tab2_top + ($tab2_hl * $index));
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -783,7 +785,7 @@ class pdf_rouget extends ModelePdfExpedition
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf;
@ -859,6 +861,7 @@ class pdf_rouget extends ModelePdfExpedition
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -868,7 +871,7 @@ class pdf_rouget extends ModelePdfExpedition
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf,$langs,$mysoc;
@ -1107,6 +1110,7 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->SetTextColor(0, 0, 0);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -1116,7 +1120,7 @@ class pdf_rouget extends ModelePdfExpedition
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -550,7 +550,7 @@ class pdf_standard extends ModeleExpenseReport
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void
*/
private function printLine(&$pdf, $object, $linenumber, $curY, $default_font_size, $outputlangs, $hidedetails = 0)
protected function printLine(&$pdf, $object, $linenumber, $curY, $default_font_size, $outputlangs, $hidedetails = 0)
{
global $conf;
$pdf->SetFont('', '', $default_font_size - 1);
@ -620,6 +620,7 @@ class pdf_standard extends ModeleExpenseReport
$pdf->writeHTMLCell($this->posxtva-$this->posxcomment-0.8, 4, $this->posxcomment-1, $curY, $comment, 0, 1);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -629,7 +630,7 @@ class pdf_standard extends ModeleExpenseReport
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
// global $conf, $langs, $hookmanager;
global $user, $langs, $conf, $mysoc, $db, $hookmanager;
@ -848,6 +849,7 @@ class pdf_standard extends ModeleExpenseReport
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -861,7 +863,7 @@ class pdf_standard extends ModeleExpenseReport
* @param string $currency Currency code
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@ -971,7 +973,7 @@ class pdf_standard extends ModeleExpenseReport
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
*/
private function tablePayments(&$pdf, $object, $posy, $outputlangs)
protected function tablePayments(&$pdf, $object, $posy, $outputlangs)
{
global $conf;
@ -1075,6 +1077,7 @@ class pdf_standard extends ModeleExpenseReport
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -1084,7 +1087,7 @@ class pdf_standard extends ModeleExpenseReport
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -342,7 +342,7 @@ class pdf_crabe extends ModelePDFFactures
// Set path to the background PDF File
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}
@ -764,7 +764,8 @@ class pdf_crabe extends ModelePDFFactures
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show payments table
*
@ -775,7 +776,7 @@ class pdf_crabe extends ModelePDFFactures
* @param int $heightforfooter height for footer
* @return int <0 if KO, >0 if OK
*/
private function _tableau_versements(&$pdf, $object, $posy, $outputlangs, $heightforfooter = 0)
protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs, $heightforfooter = 0)
{
// phpcs:enable
global $conf;
@ -911,6 +912,7 @@ class pdf_crabe extends ModelePDFFactures
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Function _tableau_versements_header
*
@ -924,7 +926,7 @@ class pdf_crabe extends ModelePDFFactures
* @param int $tab3_height height
* @return void
*/
private function _tableau_versements_header($pdf, $object, $outputlangs, $default_font_size, $tab3_posx, $tab3_top, $tab3_width, $tab3_height)
protected function _tableau_versements_header($pdf, $object, $outputlangs, $default_font_size, $tab3_posx, $tab3_top, $tab3_width, $tab3_height)
{
// phpcs:enable
$title=$outputlangs->transnoentities("PaymentsAlreadyDone");
@ -949,7 +951,8 @@ class pdf_crabe extends ModelePDFFactures
$pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show miscellaneous information (payment mode, payment term, ...)
*
@ -959,7 +962,7 @@ class pdf_crabe extends ModelePDFFactures
* @param Translate $outputlangs Langs object
* @return void
*/
private function _tableau_info(&$pdf, $object, $posy, $outputlangs)
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
@ -1108,7 +1111,8 @@ class pdf_crabe extends ModelePDFFactures
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show total to pay
*
@ -1119,7 +1123,7 @@ class pdf_crabe extends ModelePDFFactures
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@ -1451,6 +1455,7 @@ class pdf_crabe extends ModelePDFFactures
return ($tab2_top + ($tab2_hl * $index));
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -1464,7 +1469,7 @@ class pdf_crabe extends ModelePDFFactures
* @param string $currency Currency code
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@ -1572,6 +1577,7 @@ class pdf_crabe extends ModelePDFFactures
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -1581,7 +1587,7 @@ class pdf_crabe extends ModelePDFFactures
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf, $langs;
@ -1611,7 +1617,7 @@ class pdf_crabe extends ModelePDFFactures
// Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{
if (is_readable($logo))
@ -1847,6 +1853,7 @@ class pdf_crabe extends ModelePDFFactures
return $top_shift;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -1856,7 +1863,7 @@ class pdf_crabe extends ModelePDFFactures
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -352,7 +352,7 @@ class pdf_sponge extends ModelePDFFactures
// Set path to the background PDF File
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}
@ -1043,7 +1043,7 @@ class pdf_sponge extends ModelePDFFactures
* @param Translate $outputlangs Langs object
* @return void
*/
private function drawInfoTable(&$pdf, $object, $posy, $outputlangs)
protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs)
{
global $conf;
@ -1201,7 +1201,7 @@ class pdf_sponge extends ModelePDFFactures
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
private function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs)
protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
global $conf,$mysoc;
@ -1752,6 +1752,7 @@ class pdf_sponge extends ModelePDFFactures
return parent::liste_modeles($db, $maxfilenamelength); // TODO: Change the autogenerated stub
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -1765,7 +1766,7 @@ class pdf_sponge extends ModelePDFFactures
* @param string $currency Currency code
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@ -1804,6 +1805,7 @@ class pdf_sponge extends ModelePDFFactures
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -1813,7 +1815,7 @@ class pdf_sponge extends ModelePDFFactures
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf, $langs;
@ -1843,7 +1845,7 @@ class pdf_sponge extends ModelePDFFactures
// Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{
if (is_readable($logo))
@ -2077,6 +2079,7 @@ class pdf_sponge extends ModelePDFFactures
return $top_shift;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -2086,7 +2089,7 @@ class pdf_sponge extends ModelePDFFactures
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -483,6 +483,7 @@ class pdf_soleil extends ModelePDFFicheinter
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -495,7 +496,7 @@ class pdf_soleil extends ModelePDFFicheinter
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf;
@ -546,6 +547,7 @@ class pdf_soleil extends ModelePDFFicheinter
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -555,7 +557,7 @@ class pdf_soleil extends ModelePDFFicheinter
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf,$langs;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@ -722,6 +724,7 @@ class pdf_soleil extends ModelePDFFicheinter
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -731,7 +734,7 @@ class pdf_soleil extends ModelePDFFicheinter
* @param int $hidefreetext 1=Hide free text
* @return integer
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -581,8 +581,27 @@ class ImportCsv extends ModeleImports
if (is_numeric($defaultref) && $defaultref <= 0) $defaultref='';
$newval=$defaultref;
}
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='compute')
{
$file=(empty($objimport->array_import_convertvalue[0][$val]['classfile'])?$objimport->array_import_convertvalue[0][$val]['file']:$objimport->array_import_convertvalue[0][$val]['classfile']);
$class=$objimport->array_import_convertvalue[0][$val]['class'];
$method=$objimport->array_import_convertvalue[0][$val]['method'];
$resultload = dol_include_once($file);
if (empty($resultload))
{
dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method);
break;
}
$classinstance=new $class($this->db);
$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord));
if ($res<0) {
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
else $this->errors[$error]['lib']='ErrorFieldValueNotIn';
$this->errors[$error]['type']='FOREIGNKEY';
$errorforthistable++;
$error++;
}
}
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='numeric')
{
$newval = price2num($newval);

View File

@ -608,8 +608,27 @@ class ImportXlsx extends ModeleImports
if (is_numeric($defaultref) && $defaultref <= 0) $defaultref='';
$newval=$defaultref;
}
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='compute')
{
$file=(empty($objimport->array_import_convertvalue[0][$val]['classfile'])?$objimport->array_import_convertvalue[0][$val]['file']:$objimport->array_import_convertvalue[0][$val]['classfile']);
$class=$objimport->array_import_convertvalue[0][$val]['class'];
$method=$objimport->array_import_convertvalue[0][$val]['method'];
$resultload = dol_include_once($file);
if (empty($resultload))
{
dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method);
break;
}
$classinstance=new $class($this->db);
$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord));
if ($res<0) {
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
else $this->errors[$error]['lib']='ErrorFieldValueNotIn';
$this->errors[$error]['type']='FOREIGNKEY';
$errorforthistable++;
$error++;
}
}
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='numeric')
{
$newval = price2num($newval);

View File

@ -637,6 +637,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
return 0;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show miscellaneous information (payment mode, payment term, ...)
@ -647,7 +648,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
* @param Translate $outputlangs Langs object
* @return void
*/
private function _tableau_info(&$pdf, $object, $posy, $outputlangs)
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@ -666,6 +667,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$pdf->MultiCell($larg_sign, 2, $outputlangs->trans("ForCustomer").':', '', 'L');
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -678,7 +680,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf,$mysoc;
@ -731,6 +733,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -740,7 +743,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf,$langs,$hookmanager;
@ -909,6 +912,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$pdf->SetTextColor(0, 0, 60);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -918,7 +922,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -313,7 +313,7 @@ class modResource extends DolibarrModules
*
* @return int <=0 if KO, >0 if OK
*/
private function loadTables()
protected function loadTables()
{
return $this->_load_tables('/resource/sql/');
}

View File

@ -92,7 +92,7 @@ class modSyslog extends DolibarrModules
'objectname' => 'Utils',
'method' => 'compressSyslogs',
'parameters' => '',
'comment' => 'Compress and archive log files. Warning: batch must be run with same account than your web server to avoid to get log files with different owner than required by web server. Another solution is to set web server Operating System group as the group of directory documents and set GROUP permission "rws" on this directory so log files will always have the group and permissions of the web server Operating System group',
'comment' => 'Compress and archive log files. The number of versions to keep is defined into the setup of module. Warning: Main application cron script must be run with same account than your web server to avoid to get log files with different owner than required by web server. Another solution is to set web server Operating System group as the group of directory documents and set GROUP permission "rws" on this directory so log files will always have the group and permissions of the web server Operating System group',
'frequency' => 1,
'unitfrequency' => 3600 * 24,
'priority' => 50,

View File

@ -158,7 +158,7 @@ class modWebsite extends DolibarrModules
// Remove permissions and default values
$this->remove($options);
// Copy flags and octicons directoru
// Copy flags and octicons directory
$dirarray=array('common/flags', 'common/octicons');
foreach($dirarray as $dir)
{
@ -179,6 +179,26 @@ class modWebsite extends DolibarrModules
}
}
// Website templates
$srcroot=DOL_DOCUMENT_ROOT.'/install/doctemplates/websites';
$destroot=DOL_DATA_ROOT.'/doctemplates/websites';
dol_mkdir($destroot);
$docs=dol_dir_list($srcroot, 'files', 0, 'website_.*(\.zip|\.jpg)$');
foreach($docs as $cursorfile)
{
$src=$srcroot.'/'.$cursorfile['name'];
$dest=$destroot.'/'.$cursorfile['name'];
$result=dol_copy($src, $dest, 0, 0);
if ($result < 0)
{
$langs->load("errors");
$this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest);
}
}
$sql = array();
return $this->_init($sql, $options);

View File

@ -587,7 +587,7 @@ class pdf_standard extends ModelePDFProduct
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -601,7 +601,7 @@ class pdf_standard extends ModelePDFProduct
* @param string $currency Currency code
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@ -694,6 +694,7 @@ class pdf_standard extends ModelePDFProduct
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -704,7 +705,7 @@ class pdf_standard extends ModelePDFProduct
* @param string $titlekey Translation key to show as title of document
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "")
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "")
{
global $conf,$langs,$hookmanager;
@ -844,6 +845,7 @@ class pdf_standard extends ModelePDFProduct
$pdf->SetTextColor(0, 0, 0);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -853,7 +855,7 @@ class pdf_standard extends ModelePDFProduct
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -522,7 +522,7 @@ class pdf_baleine extends ModelePDFProjects
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -535,7 +535,7 @@ class pdf_baleine extends ModelePDFProjects
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf,$mysoc;
@ -573,6 +573,7 @@ class pdf_baleine extends ModelePDFProjects
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C');
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -582,7 +583,7 @@ class pdf_baleine extends ModelePDFProjects
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs,$conf,$mysoc;
@ -666,6 +667,7 @@ class pdf_baleine extends ModelePDFProjects
*/
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -675,7 +677,7 @@ class pdf_baleine extends ModelePDFProjects
* @param int $hidefreetext 1=Hide free text
* @return integer
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -695,7 +695,7 @@ class pdf_beluga extends ModelePDFProjects
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -708,7 +708,7 @@ class pdf_beluga extends ModelePDFProjects
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf,$mysoc;
@ -746,6 +746,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C');
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -755,7 +756,7 @@ class pdf_beluga extends ModelePDFProjects
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs,$conf,$mysoc;
@ -815,6 +816,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetTextColor(0, 0, 60);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -824,7 +826,7 @@ class pdf_beluga extends ModelePDFProjects
* @param int $hidefreetext 1=Hide free text
* @return integer
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -453,7 +453,7 @@ class pdf_timespent extends ModelePDFProjects
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -466,7 +466,7 @@ class pdf_timespent extends ModelePDFProjects
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf,$mysoc;
@ -504,6 +504,7 @@ class pdf_timespent extends ModelePDFProjects
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C');
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -513,7 +514,7 @@ class pdf_timespent extends ModelePDFProjects
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs,$conf,$mysoc;
@ -597,6 +598,7 @@ class pdf_timespent extends ModelePDFProjects
*/
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -606,7 +608,7 @@ class pdf_timespent extends ModelePDFProjects
* @param int $hidefreetext 1=Hide free text
* @return integer
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -344,7 +344,7 @@ class pdf_azur extends ModelePDFPropales
// Set path to the background PDF File
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}
@ -833,6 +833,7 @@ class pdf_azur extends ModelePDFPropales
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show payments table
@ -843,12 +844,12 @@ class pdf_azur extends ModelePDFPropales
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
*/
private function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show miscellaneous information (payment mode, payment term, ...)
@ -859,7 +860,7 @@ class pdf_azur extends ModelePDFPropales
* @param Translate $outputlangs Langs object
* @return void
*/
private function _tableau_info(&$pdf, $object, $posy, $outputlangs)
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
@ -1029,7 +1030,7 @@ class pdf_azur extends ModelePDFPropales
return $posy;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show total to pay
@ -1041,7 +1042,7 @@ class pdf_azur extends ModelePDFPropales
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@ -1306,6 +1307,7 @@ class pdf_azur extends ModelePDFPropales
return ($tab2_top + ($tab2_hl * $index));
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -1319,7 +1321,7 @@ class pdf_azur extends ModelePDFPropales
* @param string $currency Currency code
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@ -1422,6 +1424,7 @@ class pdf_azur extends ModelePDFPropales
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -1431,7 +1434,7 @@ class pdf_azur extends ModelePDFPropales
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf,$langs;
@ -1459,7 +1462,7 @@ class pdf_azur extends ModelePDFPropales
// Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{
if (is_readable($logo))
@ -1645,6 +1648,7 @@ class pdf_azur extends ModelePDFPropales
return $top_shift;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -1654,13 +1658,14 @@ class pdf_azur extends ModelePDFPropales
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show area for the customer to sign
@ -1671,7 +1676,7 @@ class pdf_azur extends ModelePDFPropales
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
private function _signature_area(&$pdf, $object, $posy, $outputlangs)
protected function _signature_area(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;

View File

@ -330,7 +330,7 @@ class pdf_cyan extends ModelePDFPropales
// Set path to the background PDF File
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}
@ -957,7 +957,7 @@ class pdf_cyan extends ModelePDFPropales
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
*/
private function drawPaymentsTable(&$pdf, $object, $posy, $outputlangs)
protected function drawPaymentsTable(&$pdf, $object, $posy, $outputlangs)
{
}
@ -1150,7 +1150,7 @@ class pdf_cyan extends ModelePDFPropales
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
private function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs)
protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
global $conf,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@ -1414,6 +1414,7 @@ class pdf_cyan extends ModelePDFPropales
return ($tab2_top + ($tab2_hl * $index));
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -1427,7 +1428,7 @@ class pdf_cyan extends ModelePDFPropales
* @param string $currency Currency code
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@ -1466,6 +1467,7 @@ class pdf_cyan extends ModelePDFPropales
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -1475,7 +1477,7 @@ class pdf_cyan extends ModelePDFPropales
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf,$langs;
@ -1505,7 +1507,7 @@ class pdf_cyan extends ModelePDFPropales
// Logo
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
{
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
$logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{
if (is_readable($logo))
@ -1691,6 +1693,7 @@ class pdf_cyan extends ModelePDFPropales
return $top_shift;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -1700,7 +1703,7 @@ class pdf_cyan extends ModelePDFPropales
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
@ -1716,7 +1719,7 @@ class pdf_cyan extends ModelePDFPropales
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
private function drawSignatureArea(&$pdf, $object, $posy, $outputlangs)
protected function drawSignatureArea(&$pdf, $object, $posy, $outputlangs)
{
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);

View File

@ -592,6 +592,7 @@ class pdf_squille extends ModelePdfReception
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show total to pay
@ -604,7 +605,7 @@ class pdf_squille extends ModelePdfReception
* @param int $totalOrdered Total ordered
* @return int Position pour suite
*/
private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs, $totalOrdered)
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs, $totalOrdered)
{
// phpcs:enable
global $conf,$mysoc;
@ -695,6 +696,7 @@ class pdf_squille extends ModelePdfReception
return ($tab2_top + ($tab2_hl * $index));
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -707,7 +709,7 @@ class pdf_squille extends ModelePdfReception
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf;
@ -777,6 +779,7 @@ class pdf_squille extends ModelePdfReception
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -786,7 +789,7 @@ class pdf_squille extends ModelePdfReception
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf,$langs,$mysoc;
@ -1028,6 +1031,7 @@ class pdf_squille extends ModelePdfReception
$pdf->SetTextColor(0, 0, 0);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -1037,7 +1041,7 @@ class pdf_squille extends ModelePdfReception
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -753,7 +753,7 @@ class pdf_standard extends ModelePDFStock
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -767,7 +767,7 @@ class pdf_standard extends ModelePDFStock
* @param string $currency Currency code
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@ -860,6 +860,7 @@ class pdf_standard extends ModelePDFStock
$pdf->SetLineStyle(array('dash'=>0));
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -870,7 +871,7 @@ class pdf_standard extends ModelePDFStock
* @param string $titlekey Translation key to show as title of document
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "")
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "")
{
global $conf,$langs,$db,$hookmanager;
@ -1089,6 +1090,7 @@ class pdf_standard extends ModelePDFStock
$pdf->SetTextColor(0, 0, 0);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -1098,7 +1100,7 @@ class pdf_standard extends ModelePDFStock
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -809,7 +809,7 @@ class pdf_stdmovement extends ModelePDFMovement
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -823,7 +823,7 @@ class pdf_stdmovement extends ModelePDFMovement
* @param string $currency Currency code
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@ -939,6 +939,7 @@ class pdf_stdmovement extends ModelePDFMovement
$pdf->SetLineStyle(array('dash'=>0));
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -949,7 +950,7 @@ class pdf_stdmovement extends ModelePDFMovement
* @param string $titlekey Translation key to show as title of document
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "")
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "")
{
global $conf,$langs,$db,$hookmanager;
@ -1168,6 +1169,7 @@ class pdf_stdmovement extends ModelePDFMovement
$pdf->SetTextColor(0, 0, 0);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -1177,7 +1179,7 @@ class pdf_stdmovement extends ModelePDFMovement
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -605,6 +605,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show total to pay
@ -616,7 +617,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@ -814,6 +815,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
return ($tab2_top + ($tab2_hl * $index));
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -827,7 +829,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* @param string $currency Currency code
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@ -920,6 +922,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show payments table
@ -930,7 +933,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
*/
private function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
@ -1013,6 +1016,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -1022,7 +1026,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs, $conf, $mysoc;
@ -1226,6 +1230,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
return $top_shift;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -1235,7 +1240,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -800,7 +800,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show payments table
@ -811,12 +811,12 @@ class pdf_cornas extends ModelePDFSuppliersOrders
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
*/
private function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show miscellaneous information (payment mode, payment term, ...)
@ -827,7 +827,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
* @param Translate $outputlangs Langs object
* @return integer
*/
private function _tableau_info(&$pdf, $object, $posy, $outputlangs)
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
@ -882,6 +882,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
return $posy;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show total to pay
@ -893,7 +894,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@ -1097,6 +1098,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
return ($tab2_top + ($tab2_hl * $index));
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -1110,7 +1112,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
* @param string $currency Currency code
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@ -1167,6 +1169,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -1176,7 +1179,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs,$conf,$mysoc;
@ -1412,6 +1415,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
return $top_shift;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -1421,7 +1425,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -702,7 +702,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show payments table
@ -713,12 +713,12 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
*/
private function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show miscellaneous information (payment mode, payment term, ...)
@ -729,7 +729,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* @param Translate $outputlangs Langs object
* @return integer
*/
private function _tableau_info(&$pdf, $object, $posy, $outputlangs)
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
@ -784,6 +784,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
return $posy;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show total to pay
@ -795,7 +796,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@ -999,6 +1000,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
return ($tab2_top + ($tab2_hl * $index));
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -1012,7 +1014,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* @param string $currency Currency code
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@ -1104,6 +1106,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -1113,7 +1116,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs, $conf, $mysoc;
@ -1348,6 +1351,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
return $top_shift;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -1357,7 +1361,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -517,7 +517,8 @@ class pdf_standard extends ModelePDFSuppliersPayments
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show total to pay
*
@ -527,7 +528,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
private function _tableau_cheque(&$pdf, $object, $posy, $outputlangs)
protected function _tableau_cheque(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@ -576,7 +577,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
$pdf->MultiCell(150, 4, date("d").' '.$outputlangs->transnoentitiesnoconv(date("F")).' '.date("Y"), 0, 'L', 1);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -590,7 +591,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
* @param string $currency Currency code
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf,$mysoc;
@ -621,7 +622,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
//$this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -631,7 +632,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs, $conf, $mysoc;
@ -801,6 +802,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -810,7 +812,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -700,6 +700,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show payments table
@ -710,12 +711,12 @@ class pdf_aurore extends ModelePDFSupplierProposal
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
*/
private function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show miscellaneous information (payment mode, payment term, ...)
@ -726,7 +727,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
* @param Translate $outputlangs Langs object
* @return void
*/
private function _tableau_info(&$pdf, $object, $posy, $outputlangs)
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
// phpcs:enable
global $conf;
@ -883,7 +884,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
return $posy;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show total to pay
@ -895,7 +896,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
// phpcs:enable
global $conf,$mysoc;
@ -1157,6 +1158,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
return ($tab2_top + ($tab2_hl * $index));
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show table for lines
*
@ -1170,7 +1172,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
* @param string $currency Currency code
* @return void
*/
private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{
global $conf;
@ -1262,6 +1264,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show top header of page.
*
@ -1271,7 +1274,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
* @param Translate $outputlangs Object lang for output
* @return void
*/
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf, $langs;
@ -1479,6 +1482,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
return $top_shift;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
*
@ -1488,7 +1492,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -163,11 +163,12 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg
// Show the link to "Root"
if ($showroot)
{
print '<tr><td><div style="padding-left: 5px; padding-right: 5px;"><a href="'.$_SERVER["PHP_SELF"].'?file_manager=1&pageid='.$pageid.'">'.$langs->trans("Root").'</a></div></td></tr>';
print '<tr><td><div style="padding-left: 5px; padding-right: 5px;"><a href="'.$_SERVER["PHP_SELF"].'?file_manager=1&pageid='.$pageid.'">';
if ($module == 'medias') print $langs->trans("RootOfMedias");
else print $langs->trans("Root");
print '</a></div></td></tr>';
}
print '<tr><td>';
// Show filemanager tree (will be filled by a call of ajax /ecm/tpl/enablefiletreeajax.tpl.php, later, that executes ajaxdirtree.php)

View File

@ -209,7 +209,10 @@ if ($captcha) {
<div id="login_line2" style="clear: both">
<!-- Button Connection -->
<br><input type="submit" class="button" value="&nbsp; <?php echo $langs->trans('Connection'); ?> &nbsp;" tabindex="5" />
<br>
<div id="login-submit-wrapper">
<input type="submit" class="button" value="&nbsp; <?php echo $langs->trans('Connection'); ?> &nbsp;" tabindex="5" />
</div>
<?php
if ($forgetpasslink || $helpcenterlink)
@ -221,7 +224,7 @@ if ($forgetpasslink || $helpcenterlink)
if ($dol_use_jmobile) $moreparam.=(strpos($moreparam, '?')===false?'?':'&').'dol_use_jmobile='.$dol_use_jmobile;
echo '<br>';
echo '<div class="center" style="margin-top: 15px;">';
echo '<div class="center" style="margin-top: 5px;">';
if ($forgetpasslink) {
$url=DOL_URL_ROOT.'/user/passwordforgotten.php'.$moreparam;
if (! empty($conf->global->MAIN_PASSWORD_FORGOTLINK)) $url=$conf->global->MAIN_PASSWORD_FORGOTLINK;

View File

@ -116,7 +116,6 @@ $coldisplay=0;
$toolbarname='dolibarr_details';
if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes';
$doleditor=new DolEditor('product_desc', $line->description, '', (empty($conf->global->MAIN_DOLEDITOR_HEIGHT)?164:$conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname, '', false, true, $enable, $nbrows, '98%');
$doleditor=new DolEditor('product_desc', $line->description, '', (empty($conf->global->MAIN_DOLEDITOR_HEIGHT)?164:$conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname, '', false, true, $enable, $nbrows, '98%');
$doleditor->Create();
} else {
print '<textarea id="product_desc" class="flat" name="product_desc" readonly style="width: 200px; height:80px;">' . $line->description . '</textarea>';

View File

@ -130,7 +130,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($action == 'BILL_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$ret = 0;
// First classify billed the order to allow the proposal classify process
if (! empty($conf->commande->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER))
{
@ -151,7 +152,6 @@ class InterfaceWorkflowManager extends DolibarrTriggers
}
}
}
return $ret;
}
// Second classify billed the proposal.
@ -174,8 +174,9 @@ class InterfaceWorkflowManager extends DolibarrTriggers
}
}
}
return $ret;
}
return $ret;
}
// classify billed order & billed propososal

View File

@ -94,5 +94,11 @@ if ($_SERVER['PHP_SELF'] != DOL_URL_ROOT.'/website/index.php') // If we browsing
}
}
// Load websitepage class
include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
// Show off line message
if (! defined('USEDOLIBARREDITOR') && empty($website->status))
{
$weblangs->load("website");
http_response_code(503);
print '<center><br><br>'.$weblangs->trans("SorryWebsiteIsCurrentlyOffLine").'</center>';
exit;
}

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -553,7 +553,7 @@ if ($num > 0)
}
if ($user->rights->cron->delete)
{
print "<a href=\"".$_SERVER["PHP_SELF"]."?id=".$obj->rowid."&action=delete".($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param;
print "<a href=\"".$_SERVER["PHP_SELF"]."?id=".$obj->rowid."&action=delete".($page?'&page='.$page:'').($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param;
print "\" title=\"".dol_escape_htmltag($langs->trans('CronDelete'))."\">".img_picto($langs->trans('CronDelete'), 'delete')."</a> &nbsp;";
} else {
print "<a href=\"#\" title=\"".dol_escape_htmltag($langs->trans('NotEnoughPermissions'))."\">".img_picto($langs->trans('NotEnoughPermissions'), 'delete')."</a> &nbsp; ";

View File

@ -143,7 +143,7 @@ class TraceableDB extends DoliDB
*/
public static function convertSQLFromMysql($line, $type = 'ddl')
{
return $this->db->convertSQLFromMysql($line);
return self::$db->convertSQLFromMysql($line);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

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