Merge branch 'develop' into project-funding-links
This commit is contained in:
commit
89639d8e43
6
.github/CONTRIBUTING.md
vendored
6
.github/CONTRIBUTING.md
vendored
@ -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
|
||||
|
||||
@ -288,7 +288,7 @@ script:
|
||||
# Ensure we catch errors
|
||||
set -e
|
||||
#parallel-lint --exclude htdocs/includes --blame .
|
||||
parallel-lint --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame .
|
||||
parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame .
|
||||
set +e
|
||||
echo
|
||||
|
||||
|
||||
110
ChangeLog
110
ChangeLog
@ -16,6 +16,116 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* 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()
|
||||
* Rename 'module_part' parameter into 'modulepart' into document APIs, for consistency.
|
||||
|
||||
|
||||
***** 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.1 compared to 10.0.0 *****
|
||||
|
||||
13
SECURITY.md
Normal file
13
SECURITY.md
Normal 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.
|
||||
@ -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
|
||||
|
||||
@ -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.
|
||||
|
||||
4
dev/namespacemig/README.md
Normal file
4
dev/namespacemig/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
Test to migrate Dolibarr to namespace "Dolibarr".
|
||||
|
||||
Script bbb.php is a script of an external module with current code writing.
|
||||
It must works after migration.
|
||||
23
dev/namespacemig/aaa.class.php
Normal file
23
dev/namespacemig/aaa.class.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Dolibarr;
|
||||
|
||||
|
||||
global $globalaaa;
|
||||
$globalaaa = 'globalaaa';
|
||||
|
||||
function faaa()
|
||||
{
|
||||
return 'faaa';
|
||||
}
|
||||
|
||||
class Aaa
|
||||
{
|
||||
const AAA='aaa';
|
||||
|
||||
public function do()
|
||||
{
|
||||
echo 'doaaa'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
25
dev/namespacemig/bbb.class.php
Normal file
25
dev/namespacemig/bbb.class.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
global $globalbbb;
|
||||
$globalbbb = 'globalbbb';
|
||||
|
||||
function fbbb()
|
||||
{
|
||||
return 'fbbb';
|
||||
}
|
||||
|
||||
class Bbb
|
||||
{
|
||||
const BBB='bbb';
|
||||
public function do()
|
||||
{
|
||||
global $globalaaa, $globalbbb;
|
||||
echo 'dobbb'."\n";
|
||||
$globalaaa.='+bbb';
|
||||
$globalbbb.='+bbb';
|
||||
}
|
||||
}
|
||||
|
||||
31
dev/namespacemig/bbb.php
Executable file
31
dev/namespacemig/bbb.php
Executable file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
//use \Aaa as Aaa;
|
||||
|
||||
use Dolibarr\Aaa as Aaa;
|
||||
use function Dolibarr\faaa as faaa; // Need php 5.6+
|
||||
//use const Dolibarr\AAA;
|
||||
|
||||
//use Bbb as Bbb;
|
||||
|
||||
require './main.inc.php';
|
||||
require './aaa.class.php';
|
||||
require './bbb.class.php';
|
||||
|
||||
$bbb = new Bbb();
|
||||
$bbb->do();
|
||||
|
||||
$aaa = new Aaa();
|
||||
$aaa->do();
|
||||
|
||||
echo $aaa::AAA."\n";
|
||||
echo $bbb::BBB."\n";
|
||||
|
||||
echo Aaa::AAA."\n";
|
||||
echo Bbb::BBB."\n";
|
||||
|
||||
echo faaa()."\n";
|
||||
echo fbbb()."\n";
|
||||
|
||||
echo "globalaaa=$globalaaa\n";
|
||||
echo "globalbbb=$globalbbb\n";
|
||||
7
dev/namespacemig/main.inc.php
Normal file
7
dev/namespacemig/main.inc.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*spl_autoload_register(function ($class_name) {
|
||||
var_dump('class='.$class_name);
|
||||
require $class_name;
|
||||
});
|
||||
*/
|
||||
@ -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.
|
||||
|
||||
@ -5,7 +5,9 @@
|
||||
|
||||
<exclude-pattern type="relative">build/html</exclude-pattern>
|
||||
<exclude-pattern type="relative">build/aps</exclude-pattern>
|
||||
<exclude-pattern type="relative">dev/namespacemig</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>
|
||||
|
||||
@ -73,19 +73,11 @@ $y = $year_current;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width=150>' . $langs->trans("Label") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("JanuaryMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("FebruaryMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("MarchMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("AprilMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("MayMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("JuneMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("JulyMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("AugustMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("SeptemberMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("OctoberMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("NovemberMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("DecemberMin") . '</td>';
|
||||
print '<td class="center"><strong>Total</strong></td>';
|
||||
for($i = 1; $i <= 12; $i++)
|
||||
{
|
||||
print '<td class="right">' . $langs->trans("MonthShort".sprintf("%02s", $i)) . '</td>';
|
||||
}
|
||||
print '<td class="center"><strong>'.$langs->trans("Total").'</strong></td>';
|
||||
print '</tr>';
|
||||
|
||||
$sql = "SELECT bk.numero_compte AS 'compte',";
|
||||
|
||||
@ -2315,6 +2315,7 @@ class Adherent extends CommonObject
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay=$conf->adherent->subscription->warning_delay/60/60/24;
|
||||
$response->label=$langs->trans("MembersWithSubscriptionToReceive");
|
||||
$response->labelShort=$langs->trans("MembersWithSubscriptionToReceiveShort");
|
||||
$response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate';
|
||||
$response->img=img_object('', "user");
|
||||
|
||||
|
||||
@ -35,7 +35,10 @@ if (!$user->admin)
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
|
||||
|
||||
$arrayofparameters=array(
|
||||
'DAV_RESTICT_ON_IP'=>array('css'=>'minwidth200', 'enabled'=>1),
|
||||
'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2),
|
||||
'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1),
|
||||
'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled)
|
||||
@ -68,7 +71,6 @@ $head=dav_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'webdav', '', -1, 'action');
|
||||
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
@ -76,14 +78,17 @@ if ($action == 'edit')
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach($arrayofparameters as $key => $val)
|
||||
{
|
||||
if (isset($val['enabled']) && empty($val['enabled'])) continue;
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
|
||||
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
|
||||
$label = $langs->trans($key);
|
||||
if ($key == 'DAV_RESTICT_ON_IP') $label = $langs->trans("RESTRICT_ON_IP");
|
||||
print $form->textwithpicto($label, $tooltiphelp);
|
||||
print '</td><td>';
|
||||
if ($key == 'DAV_ALLOW_PRIVATE_DIR')
|
||||
{
|
||||
@ -112,12 +117,13 @@ if ($action == 'edit')
|
||||
else
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach($arrayofparameters as $key => $val)
|
||||
{
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
|
||||
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
|
||||
print $form->textwithpicto($langs->trans($key), $tooltiphelp);
|
||||
print '</td><td>';
|
||||
if ($key == 'DAV_ALLOW_PRIVATE_DIR')
|
||||
{
|
||||
@ -177,6 +183,13 @@ if (! empty($conf->global->DAV_ALLOW_PUBLIC_DIR))
|
||||
}
|
||||
print $message;
|
||||
|
||||
print '<br><br><br>';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/sabre/autoload.php';
|
||||
$version = Sabre\DAV\Version::VERSION;
|
||||
print '<span class="opacitymedium">'.$langs->trans("BaseOnSabeDavVersion").' : '.$version.'</span>';
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -195,7 +195,6 @@ if ($action == 'edit')
|
||||
{
|
||||
foreach($delays as $delay)
|
||||
{
|
||||
|
||||
$value=(! empty($conf->global->{$delay['code']})?$conf->global->{$delay['code']}:0);
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="20px">'.img_object('', $delay['img']).'</td>';
|
||||
@ -235,7 +234,6 @@ else
|
||||
{
|
||||
foreach($delays as $delay)
|
||||
{
|
||||
|
||||
$value=(! empty($conf->global->{$delay['code']})?$conf->global->{$delay['code']}:0);
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="20px">'.img_object('', $delay['img']).'</td>';
|
||||
@ -264,7 +262,7 @@ else
|
||||
print '<br>';
|
||||
|
||||
// Show logo for weather
|
||||
print $langs->trans("DescWeather").'<br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescWeather").'</span> ';
|
||||
|
||||
if($action == 'edit') {
|
||||
|
||||
@ -300,16 +298,16 @@ if ($action == 'edit') {
|
||||
|
||||
print '<div>';
|
||||
print '<div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-clear.png', $options);
|
||||
print img_weather($text, 0, $options);
|
||||
print '= <input type="text" size="2" name="MAIN_METEO_LEVEL0" value="'.$level0.'"/></td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-few-clouds.png', $options);
|
||||
print img_weather($text, 1, $options);
|
||||
print '<= <input type="text" size="2" name="MAIN_METEO_LEVEL1" value="'.$level1.'"/></td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-clouds.png', $options);
|
||||
print img_weather($text, 2, $options);
|
||||
print '<= <input type="text" size="2" name="MAIN_METEO_LEVEL2" value="'.$level2.'"/></td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-many-clouds.png', $options);
|
||||
print img_weather($text, 3, $options);
|
||||
print '<= <input type="text" size="2" name="MAIN_METEO_LEVEL3" value="'.$level3.'"/></td>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
@ -320,16 +318,16 @@ if ($action == 'edit') {
|
||||
|
||||
print '<div>';
|
||||
print '<div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-clear.png', $options);
|
||||
print '= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.'"/> %</td>';
|
||||
print img_weather($text, 0, $options);
|
||||
print '<= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.'"/> %</td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-few-clouds.png', $options);
|
||||
print img_weather($text, 1, $options);
|
||||
print '<= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.'"/> %</td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-clouds.png', $options);
|
||||
print img_weather($text, 2, $options);
|
||||
print '<= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL2" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.'"/> %</td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-many-clouds.png', $options);
|
||||
print img_weather($text, 3, $options);
|
||||
print '<= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL3" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.'"/> %</td>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
@ -371,19 +369,19 @@ if ($action == 'edit') {
|
||||
|
||||
print '<div>';
|
||||
print '<div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-clear.png', $options);
|
||||
print img_weather($text, 0, $options);
|
||||
print '= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.' %</td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-few-clouds.png', $options);
|
||||
print img_weather($text, 1, $options);
|
||||
print '<= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.' %</td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-clouds.png', $options);
|
||||
print img_weather($text, 2, $options);
|
||||
print '<= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.' %</td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-many-clouds.png', $options);
|
||||
print img_weather($text, 3, $options);
|
||||
print '<= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.' %</td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-storm.png', $options);
|
||||
print img_weather($text, 4, $options);
|
||||
print '> '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.' %</td>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
@ -391,19 +389,19 @@ if ($action == 'edit') {
|
||||
|
||||
print '<div>';
|
||||
print '<div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-clear.png', $options);
|
||||
print img_weather($text, 0, $options);
|
||||
print '= '.$level0;
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-few-clouds.png', $options);
|
||||
print img_weather($text, 1, $options);
|
||||
print '<= '.$level1;
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-clouds.png', $options);
|
||||
print img_weather($text, 2, $options);
|
||||
print '<= '.$level2;
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-many-clouds.png', $options);
|
||||
print img_weather($text, 3, $options);
|
||||
print '<= '.$level3;
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-storm.png', $options);
|
||||
print img_weather($text, 4, $options);
|
||||
print '> '.$level3;
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.org>
|
||||
/* Copyright (C) 2009-2019 Laurent Destailleur <eldy@users.sourceforge.org>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -36,9 +36,11 @@ $langs->loadLangs(array("admin","errors"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'set')
|
||||
{
|
||||
$error=0;
|
||||
@ -53,8 +55,11 @@ if ($action == 'set')
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$res = dolibarr_set_const($db, "GEOIPMAXMIND_COUNTRY_DATAFILE", $gimcdf, 'chaine', 0, '', $conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
$res1 = dolibarr_set_const($db, "GEOIP_VERSION", GETPOST('geoipversion', 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
if (! $res1 > 0) $error++;
|
||||
|
||||
$res2 = dolibarr_set_const($db, "GEOIPMAXMIND_COUNTRY_DATAFILE", $gimcdf, 'chaine', 0, '', $conf->entity);
|
||||
if (! $res2 > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
@ -67,6 +72,8 @@ if ($action == 'set')
|
||||
}
|
||||
}
|
||||
|
||||
if (! isset($conf->global->GEOIP_VERSION)) $conf->global->GEOIP_VERSION = '2';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -85,13 +92,6 @@ $geoip='';
|
||||
if (! empty($conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE))
|
||||
{
|
||||
$geoip=new DolGeoIP('country', $conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE);
|
||||
//if ($geoip->error) print dol_htmloutput_errors($geoip->errorlabel,'',1);
|
||||
if ($geoip->gi == 'NOGI') $geointernal=true;
|
||||
else $geointernal=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (function_exists('geoip_country_code_by_name')) $geointernal=true;
|
||||
}
|
||||
|
||||
// Mode
|
||||
@ -105,16 +105,30 @@ print '<td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td
|
||||
print '<td class="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td width=\"50%\">'.$langs->trans("PathToGeoIPMaxmindCountryDataFile").'</td>';
|
||||
// Lib version
|
||||
print '<tr class="oddeven"><td width="50%">'.$langs->trans("GeoIPLibVersion").'</td>';
|
||||
print '<td colspan="2">';
|
||||
$arrayofvalues = array('php' => 'Native PHP functions', '1' => 'Embedded GeoIP v1', '2' => 'Embedded GeoIP v2');
|
||||
print $form->selectarray('geoipversion', $arrayofvalues, (isset($conf->global->GEOIP_VERSION) ? $conf->global->GEOIP_VERSION : '2'));
|
||||
if ($conf->global->GEOIP_VERSION == 'php')
|
||||
{
|
||||
if ($geoip) $version=$geoip->getVersion();
|
||||
if ($version)
|
||||
{
|
||||
print '<br>'.$langs->trans("Version").': '.$version;
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Path to database file
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PathToGeoIPMaxmindCountryDataFile").'</td>';
|
||||
print '<td colspan="2">';
|
||||
|
||||
if ($geointernal) print 'Using geoip PHP internal functions. Value must be '.geoip_db_filename(GEOIP_COUNTRY_EDITION).' or '.geoip_db_filename(GEOIP_CITY_EDITION_REV1).'<br>';
|
||||
print '<input size="50" type="text" name="GEOIPMAXMIND_COUNTRY_DATAFILE" value="'.$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE.'">';
|
||||
if ($geoip) $version=$geoip->getVersion();
|
||||
if ($version)
|
||||
if ($conf->global->GEOIP_VERSION == 'php')
|
||||
{
|
||||
print '<br>'.$langs->trans("Version").': '.$version;
|
||||
print 'Using geoip PHP internal functions. Value must be '.geoip_db_filename(GEOIP_COUNTRY_EDITION).' or '.geoip_db_filename(GEOIP_CITY_EDITION_REV1).' or /pathtodatafile/GeoLite2-Country.mmdb<br>';
|
||||
}
|
||||
print '<input size="50" type="text" name="GEOIPMAXMIND_COUNTRY_DATAFILE" value="'.$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -144,6 +158,13 @@ if ($geoip)
|
||||
if ($result) print $result;
|
||||
else print $langs->trans("Error");
|
||||
|
||||
$ip='2a01:e0a:7e:4a60:429a:23ff:f7b8:dc8a'; // should be France
|
||||
print '<br>'.$ip.' -> ';
|
||||
$result=dol_print_ip($ip, 1);
|
||||
if ($result) print $result;
|
||||
else print $langs->trans("Error");
|
||||
|
||||
|
||||
/* We disable this test because dol_print_ip need an ip as input
|
||||
$ip='www.google.com';
|
||||
print '<br>'.$ip.' -> ';
|
||||
|
||||
@ -130,13 +130,13 @@ if ($action=='install')
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! preg_match('/\.zip$/i', $original_file))
|
||||
if (! $error && ! preg_match('/\.zip$/i', $original_file))
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage", $original_file), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! preg_match('/module_.*\-[\d]+\.[\d]+.*$/i', $original_file))
|
||||
if (! $error && ! preg_match('/^(module[a-zA-Z0-9]*|theme)_.*\-([0-9][0-9\.]*)\.zip$/i', $original_file))
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules", $original_file, 'module_*-x.y*.zip'), null, 'errors');
|
||||
@ -180,13 +180,13 @@ if ($action=='install')
|
||||
{
|
||||
// Now we move the dir of the module
|
||||
$modulename=preg_replace('/module_/', '', $original_file);
|
||||
$modulename=preg_replace('/\-[\d]+\.[\d]+.*$/', '', $modulename);
|
||||
$modulename=preg_replace('/\-([0-9][0-9\.]*)\.zip$/i', '', $modulename);
|
||||
// Search dir $modulename
|
||||
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename;
|
||||
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename; // Example .../mymodule
|
||||
//var_dump($modulenamedir);
|
||||
if (! dol_is_dir($modulenamedir))
|
||||
{
|
||||
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename;
|
||||
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename; // Example .../htdocs/mymodule
|
||||
//var_dump($modulenamedir);
|
||||
if (! dol_is_dir($modulenamedir))
|
||||
{
|
||||
@ -195,10 +195,16 @@ if ($action=='install')
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// TODO Make more test
|
||||
}
|
||||
|
||||
// Now we install the module
|
||||
if (! $error)
|
||||
{
|
||||
//var_dump($dirins);
|
||||
@dol_delete_dir_recursive($dirins.'/'.$modulename);
|
||||
@dol_delete_dir_recursive($dirins.'/'.$modulename); // delete the zip file
|
||||
dol_syslog("Uncompress of module file is a success. We copy it from ".$modulenamedir." into target dir ".$dirins.'/'.$modulename);
|
||||
$result=dolCopyDir($modulenamedir, $dirins.'/'.$modulename, '0444', 1);
|
||||
if ($result <= 0)
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -118,14 +118,14 @@ function create_script_table($list)
|
||||
{
|
||||
global $sortby,$langs;
|
||||
|
||||
if (GETPOT('order') == "asc" || GETPOST('order') =="desc") {
|
||||
$order = GETPOST('order');
|
||||
if (GETPOT('order', 'alpha') == "asc" || GETPOST('order', 'alpha') == "desc") {
|
||||
$order = GETPOST('order', 'alpha');
|
||||
} else {
|
||||
$order = "asc";
|
||||
}
|
||||
|
||||
if (GETPOST('order')) {
|
||||
switch (GETPOST('order')) {
|
||||
if (GETPOST('order', 'alpha')) {
|
||||
switch (GETPOST('order', 'alpha')) {
|
||||
case "mtime":
|
||||
case "size":
|
||||
case "reloads":
|
||||
|
||||
@ -618,14 +618,14 @@ if ($id)
|
||||
|
||||
// Active
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<a href="'.$url.'action='.$acts[($obj->status?1:0)].'">'.$actl[($obj->status?1:0)].'</a>';
|
||||
print '<a class="reposition" href="'.$url.'action='.$acts[($obj->status?1:0)].'">'.$actl[($obj->status?1:0)].'</a>';
|
||||
print "</td>";
|
||||
|
||||
// Modify link
|
||||
print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
|
||||
|
||||
// Delete link
|
||||
if ($iserasable) print '<td align="center"><a href="'.$url.'action=delete">'.img_delete().'</a></td>';
|
||||
if ($iserasable) print '<td align="center"><a class="reposition" href="'.$url.'action=delete">'.img_delete().'</a></td>';
|
||||
else print '<td align="center">'.img_delete($langs->trans("DisableSiteFirst"), 'class="opacitymedium"').'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
@ -78,6 +78,12 @@ if ($action == 'setproductionmode')
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'save')
|
||||
{
|
||||
dolibarr_set_const($db, 'API_RESTRICT_ON_IP', GETPOST('API_RESTRICT_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> </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> </td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("RESTRICT_API_ON_IP").'</td>';
|
||||
print '<td><input type="text" name="API_RESTRICT_ON_IP" value="'.dol_escape_htmltag($conf->global->API_RESTRICT_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
|
||||
|
||||
@ -32,7 +32,7 @@ class DolibarrApi
|
||||
/**
|
||||
* @var DoliDb $db Database object
|
||||
*/
|
||||
static protected $db;
|
||||
protected static $db;
|
||||
|
||||
/**
|
||||
* @var Restler $r Restler object
|
||||
|
||||
@ -56,7 +56,7 @@ class Documents extends DolibarrApi
|
||||
* Note that, this API is similar to using the wrapper link "documents.php" to download a file (used for
|
||||
* internal HTML links of documents into application), but with no need to have a session cookie (the token is used instead).
|
||||
*
|
||||
* @param string $module_part Name of module or area concerned by file download ('facture', ...)
|
||||
* @param string $modulepart Name of module or area concerned by file download ('facture', ...)
|
||||
* @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf)
|
||||
* @return array List of documents
|
||||
*
|
||||
@ -67,11 +67,11 @@ class Documents extends DolibarrApi
|
||||
*
|
||||
* @url GET /download
|
||||
*/
|
||||
public function index($module_part, $original_file = '')
|
||||
public function index($modulepart, $original_file = '')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
if (empty($module_part)) {
|
||||
if (empty($modulepart)) {
|
||||
throw new RestException(400, 'bad value for parameter modulepart');
|
||||
}
|
||||
if (empty($original_file)) {
|
||||
@ -81,7 +81,7 @@ class Documents extends DolibarrApi
|
||||
//--- Finds and returns the document
|
||||
$entity=$conf->entity;
|
||||
|
||||
$check_access = dol_check_secure_access_document($module_part, $original_file, $entity, DolibarrApiAccess::$user, '', 'read');
|
||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'read');
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||
$original_file = $check_access['original_file'];
|
||||
@ -98,6 +98,7 @@ class Documents extends DolibarrApi
|
||||
|
||||
if (! file_exists($original_file_osencoded))
|
||||
{
|
||||
dol_syslog("Try to download not found file ".$original_file_osencoded, LOG_WARNING);
|
||||
throw new RestException(404, 'File not found');
|
||||
}
|
||||
|
||||
@ -111,7 +112,7 @@ class Documents extends DolibarrApi
|
||||
*
|
||||
* Test sample 1: { "module_part": "invoice", "original_file": "FA1701-001/FA1701-001.pdf", "doctemplate": "crabe", "langcode": "fr_FR" }.
|
||||
*
|
||||
* @param string $module_part Name of module or area concerned by file download ('invoice', 'order', ...).
|
||||
* @param string $modulepart Name of module or area concerned by file download ('invoice', 'order', ...).
|
||||
* @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf).
|
||||
* @param string $doctemplate Set here the doc template to use for document generation (If not set, use the default template).
|
||||
* @param string $langcode Language code like 'en_US', 'fr_FR', 'es_ES', ... (If not set, use the default language).
|
||||
@ -126,11 +127,11 @@ class Documents extends DolibarrApi
|
||||
*
|
||||
* @url PUT /builddoc
|
||||
*/
|
||||
public function builddoc($module_part, $original_file = '', $doctemplate = '', $langcode = '')
|
||||
public function builddoc($modulepart, $original_file = '', $doctemplate = '', $langcode = '')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
if (empty($module_part)) {
|
||||
if (empty($modulepart)) {
|
||||
throw new RestException(400, 'bad value for parameter modulepart');
|
||||
}
|
||||
if (empty($original_file)) {
|
||||
@ -147,7 +148,7 @@ class Documents extends DolibarrApi
|
||||
//--- Finds and returns the document
|
||||
$entity=$conf->entity;
|
||||
|
||||
$check_access = dol_check_secure_access_document($module_part, $original_file, $entity, DolibarrApiAccess::$user, '', 'write');
|
||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'write');
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||
$original_file = $check_access['original_file'];
|
||||
@ -166,7 +167,7 @@ class Documents extends DolibarrApi
|
||||
|
||||
$templateused='';
|
||||
|
||||
if ($module_part == 'facture' || $module_part == 'invoice')
|
||||
if ($modulepart == 'facture' || $modulepart == 'invoice')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$this->invoice = new Facture($this->db);
|
||||
@ -181,7 +182,7 @@ class Documents extends DolibarrApi
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
}
|
||||
elseif ($module_part == 'commande' || $module_part == 'order')
|
||||
elseif ($modulepart == 'commande' || $modulepart == 'order')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$this->order = new Commande($this->db);
|
||||
@ -195,7 +196,7 @@ class Documents extends DolibarrApi
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
}
|
||||
elseif ($module_part == 'propal' || $module_part == 'proposal')
|
||||
elseif ($modulepart == 'propal' || $modulepart == 'proposal')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
$this->propal = new Propal($this->db);
|
||||
|
||||
@ -57,12 +57,13 @@ class Login
|
||||
*/
|
||||
public function index($login, $password, $entity = '', $reset = 0)
|
||||
{
|
||||
|
||||
global $conf, $dolibarr_main_authentication, $dolibarr_auto_user;
|
||||
|
||||
// Authentication mode
|
||||
if (empty($dolibarr_main_authentication))
|
||||
$dolibarr_main_authentication = 'http,dolibarr';
|
||||
// TODO Remove the API login. The token must be generated from backoffice only.
|
||||
|
||||
// Authentication mode
|
||||
if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication = 'dolibarr';
|
||||
|
||||
// Authentication mode: forceuser
|
||||
if ($dolibarr_main_authentication == 'forceuser')
|
||||
{
|
||||
@ -73,6 +74,7 @@ class Login
|
||||
throw new RestException(403, "Your instance is set to use the automatic login '".$dolibarr_auto_user."' that is not the requested login. API usage is forbidden in this mode.");
|
||||
}
|
||||
}
|
||||
|
||||
// Set authmode
|
||||
$authmode = explode(',', $dolibarr_main_authentication);
|
||||
|
||||
@ -83,7 +85,7 @@ class Login
|
||||
if ($entity == '') $entity=1;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php';
|
||||
$login = checkLoginPassEntity($login, $password, $entity, $authmode);
|
||||
$login = checkLoginPassEntity($login, $password, $entity, $authmode, 'api');
|
||||
if (empty($login))
|
||||
{
|
||||
throw new RestException(403, 'Access denied');
|
||||
|
||||
@ -24,6 +24,8 @@
|
||||
* \file htdocs/api/index.php
|
||||
*/
|
||||
|
||||
use Luracast\Restler\Format\UploadFormat;
|
||||
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
|
||||
@ -117,6 +119,21 @@ $api->r->addAuthenticationClass('DolibarrApiAccess', '');
|
||||
UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain', 'application/octet-stream');
|
||||
|
||||
|
||||
// Restrict API to some IPs
|
||||
if (! empty($conf->global->API_RESTRICT_ON_IP))
|
||||
{
|
||||
$allowedip=explode(' ', $conf->global->API_RESTRICT_ON_IP);
|
||||
$ipremote = getUserRemoteIP();
|
||||
if (! in_array($ipremote, $allowedip))
|
||||
{
|
||||
dol_syslog('Remote ip is '.$ipremote.', not into list '.$conf->global->API_RESTRICT_ON_IP);
|
||||
print 'APIs are not allowed from the IP '.$ipremote;
|
||||
header('HTTP/1.1 503 API not allowed from your IP '.$ipremote);
|
||||
//print $conf->global->API_RESTRICT_ON_IP;
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Call Explorer file for all APIs definitions (this part is slow)
|
||||
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||
@ -136,6 +153,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' ||
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
$regmod=array();
|
||||
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i", $file, $regmod))
|
||||
{
|
||||
$module = strtolower($regmod[1]);
|
||||
@ -165,6 +183,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' ||
|
||||
{
|
||||
if ($file_searched == 'api_access.class.php') continue;
|
||||
|
||||
$regapi = array();
|
||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i", $file_searched, $regapi))
|
||||
{
|
||||
$classname = ucwords($regapi[1]);
|
||||
@ -204,6 +223,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' ||
|
||||
}
|
||||
|
||||
// Call one APIs or one definition of an API
|
||||
$regbis = array();
|
||||
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')))
|
||||
{
|
||||
$module = $reg[1];
|
||||
@ -253,7 +273,6 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
||||
$api->r->addAPIClass($classname);
|
||||
}
|
||||
|
||||
// TODO If not found, redirect to explorer
|
||||
//var_dump($api->r->apiVersionMap);
|
||||
//exit;
|
||||
|
||||
|
||||
@ -1103,6 +1103,7 @@ class ActionComm extends CommonObject
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay = $conf->agenda->warning_delay/60/60/24;
|
||||
$response->label = $langs->trans("ActionsToDo");
|
||||
$response->labelShort = $langs->trans("ActionsToDoShort");
|
||||
$response->url = DOL_URL_ROOT.'/comm/action/list.php?actioncode=0&status=todo&mainmenu=agenda';
|
||||
if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1';
|
||||
$response->img = img_object('', "action", 'class="inline-block valigntextmiddle"');
|
||||
@ -1286,8 +1287,10 @@ class ActionComm extends CommonObject
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
|
||||
if ((!$user->rights->agenda->allactions->read && $this->authorid != $user->id) || (!$user->rights->agenda->myactions->read && $this->authorid == $user->id))
|
||||
if ((!$user->rights->agenda->allactions->read && $this->authorid != $user->id) || (!$user->rights->agenda->myactions->read && $this->authorid == $user->id))
|
||||
{
|
||||
$option = 'nolink';
|
||||
}
|
||||
|
||||
$label = $this->label;
|
||||
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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>
|
||||
@ -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);
|
||||
}
|
||||
@ -3277,21 +3268,24 @@ class Propal extends CommonObject
|
||||
|
||||
$delay_warning = 0;
|
||||
$statut = 0;
|
||||
$label = '';
|
||||
$label = $labelShort = '';
|
||||
if ($mode == 'opened') {
|
||||
$delay_warning=$conf->propal->cloture->warning_delay;
|
||||
$statut = self::STATUS_VALIDATED;
|
||||
$label = $langs->trans("PropalsToClose");
|
||||
$labelShort = $langs->trans("ToAcceptRefuse");
|
||||
}
|
||||
if ($mode == 'signed') {
|
||||
$delay_warning=$conf->propal->facturation->warning_delay;
|
||||
$statut = self::STATUS_SIGNED;
|
||||
$label = $langs->trans("PropalsToBill"); // We set here bill but may be billed or ordered
|
||||
$labelShort = $langs->trans("ToBill");
|
||||
}
|
||||
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay = $delay_warning/60/60/24;
|
||||
$response->label = $label;
|
||||
$response->labelShort = $labelShort;
|
||||
$response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals';
|
||||
$response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc';
|
||||
$response->img = img_object('', "propal");
|
||||
|
||||
@ -1062,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
|
||||
|
||||
@ -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&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 . '&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 . '&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 . '&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 . '&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&origin=' . $object->element . '&originid=' . $object->id . '&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 . '&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 . '&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 . '&socid=' . $object->socid . '&action=clone&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 . '&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 . '&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';
|
||||
|
||||
@ -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;
|
||||
@ -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);
|
||||
@ -3411,6 +3412,7 @@ class Commande extends CommonOrder
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay=$conf->commande->client->warning_delay/60/60/24;
|
||||
$response->label=$langs->trans("OrdersToProcess");
|
||||
$response->labelShort = $langs->trans("Opened");
|
||||
$response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3&mainmenu=commercial&leftmenu=orders';
|
||||
$response->img=img_object('', "order");
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -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;
|
||||
@ -218,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';
|
||||
}
|
||||
@ -934,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>';
|
||||
@ -1081,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
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -236,8 +236,13 @@ if ($action == 'update')
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||
$db->begin();
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
@ -252,10 +257,20 @@ if ($action == 'update')
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='edit'; // Force chargement page edition
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->banque->configurer)
|
||||
@ -412,7 +427,7 @@ if ($action == 'create')
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
// Other attributes
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
@ -639,12 +654,12 @@ else
|
||||
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
|
||||
print '<td>';
|
||||
|
||||
if ($object->fk_accountancy_journal > 0) {
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$accountingjournal->fetch($object->fk_accountancy_journal);
|
||||
if ($object->fk_accountancy_journal > 0) {
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$accountingjournal->fetch($object->fk_accountancy_journal);
|
||||
|
||||
print $accountingjournal->getNomUrl(0, 1, 1, '', 1);
|
||||
}
|
||||
print $accountingjournal->getNomUrl(0, 1, 1, '', 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -749,7 +749,6 @@ class Account extends CommonObject
|
||||
$sql.= ",fk_pays = ".$this->country_id;
|
||||
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
@ -1225,6 +1224,7 @@ class Account extends CommonObject
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay=$conf->bank->rappro->warning_delay/60/60/24;
|
||||
$response->label=$langs->trans("TransactionsToConciliate");
|
||||
$response->labelShort = $langs->trans("TransactionsToConciliateShort");
|
||||
$response->url=DOL_URL_ROOT.'/compta/bank/list.php?leftmenu=bank&mainmenu=bank';
|
||||
$response->img=img_object('', "payment");
|
||||
|
||||
@ -1276,7 +1276,6 @@ class Account extends CommonObject
|
||||
$this->nb["banklines"]=$obj->nb;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -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
|
||||
*
|
||||
|
||||
@ -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;
|
||||
@ -312,7 +312,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
||||
$reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if(empty($reshook)){
|
||||
print $hookmanager->resPrint;
|
||||
$solde = isset($hookmanager->resArray['solde']) ? $hookmanager->resArray['solde'] : $solde;
|
||||
$solde = isset($hookmanager->resArray['solde']) ? $hookmanager->resArray['solde'] : $solde;
|
||||
}
|
||||
|
||||
// solde
|
||||
|
||||
@ -88,7 +88,7 @@ if (empty($backtopage)) $backtopage = dol_buildpath('/compta/cashcontrol/cashcon
|
||||
$backurlforlist = dol_buildpath('/compta/cashcontrol/cashcontrol_list.php', 1);
|
||||
$triggermodname = 'CACHCONTROL_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||
|
||||
if (empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH))
|
||||
if (empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH) && empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH1))
|
||||
{
|
||||
setEventMessages($langs->trans("CashDesk")." - ".$langs->trans("NotConfigured"), null, 'errors');
|
||||
}
|
||||
@ -132,16 +132,7 @@ elseif ($action=="add")
|
||||
$error=0;
|
||||
foreach($arrayofpaymentmode as $key=>$val)
|
||||
{
|
||||
if (GETPOST($key.'_amount', 'alpha') == '')
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val)), null, 'errors');
|
||||
$action='start';
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->$key = price2num(GETPOST($key.'_amount', 'alpha'));
|
||||
}
|
||||
$object->$key = price2num(GETPOST($key.'_amount', 'alpha'));
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -235,7 +226,14 @@ if ($action=="create" || $action=="start")
|
||||
$posmodule = GETPOST('posmodule', 'alpha');
|
||||
$terminalid = GETPOST('posnumber', 'alpha');
|
||||
$terminaltouse = $terminalid;
|
||||
if ($terminaltouse == '1') $terminaltouse = '';
|
||||
|
||||
if ($terminaltouse == '1' && $posmodule=='cashdesk') $terminaltouse = '';
|
||||
|
||||
if ($posmodule=='cashdesk' && $terminaltouse != '' && $terminaltouse != '1') {
|
||||
$terminaltouse = '';
|
||||
setEventMessages($langs->trans("OnlyTerminal1IsAvailableForCashDeskModule"), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Calculate $initialbalanceforterminal for terminal 0
|
||||
foreach($arrayofpaymentmode as $key => $val)
|
||||
@ -271,7 +269,7 @@ if ($action=="create" || $action=="start")
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("SetupOfTerminalNotComplete", $terminalid), null, 'errors');
|
||||
setEventMessages($langs->trans("SetupOfTerminalNotComplete", $terminaltouse), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,10 +196,18 @@ if ($resql)
|
||||
// Bank account
|
||||
print '<td class="nowrap right">';
|
||||
print $bankaccount->getNomUrl(1);
|
||||
if ($conf->global->CASHDESK_ID_BANKACCOUNT_CASH==$bankaccount->id) $cash+=$objp->amount;
|
||||
elseif ($conf->global->CASHDESK_ID_BANKACCOUNT_CB==$bankaccount->id) $bank+=$objp->amount;
|
||||
elseif ($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE==$bankaccount->id) $cheque+=$objp->amount;
|
||||
else $other+=$objp->amount;
|
||||
if ($cashcontrol->posmodule=="takepos"){
|
||||
if ($conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$cashcontrol->posnumber}==$bankaccount->id) $cash+=$objp->amount;
|
||||
elseif ($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$cashcontrol->posnumber}==$bankaccount->id) $bank+=$objp->amount;
|
||||
elseif ($conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$cashcontrol->posnumber}==$bankaccount->id) $cheque+=$objp->amount;
|
||||
else $other+=$objp->amount;
|
||||
}
|
||||
else{
|
||||
if ($conf->global->CASHDESK_ID_BANKACCOUNT_CASH==$bankaccount->id) $cash+=$objp->amount;
|
||||
elseif ($conf->global->CASHDESK_ID_BANKACCOUNT_CB==$bankaccount->id) $bank+=$objp->amount;
|
||||
elseif ($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE==$bankaccount->id) $cheque+=$objp->amount;
|
||||
else $other+=$objp->amount;
|
||||
}
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -3316,8 +3312,8 @@ if ($action == 'create')
|
||||
'__INVOICE_PREVIOUS_MONTH_TEXT__' => $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B').')',
|
||||
'__INVOICE_MONTH_TEXT__' => $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%B').')',
|
||||
'__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')',
|
||||
'__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')',
|
||||
'__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')',
|
||||
'__INVOICE_PREVIOUS_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')',
|
||||
'__INVOICE_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')',
|
||||
'__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y').')'
|
||||
);
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -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);
|
||||
@ -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";
|
||||
@ -3921,6 +3924,7 @@ class Facture extends CommonInvoice
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay=$conf->facture->client->warning_delay/60/60/24;
|
||||
$response->label=$langs->trans("CustomerBillsUnpaid");
|
||||
$response->labelShort=$langs->trans("Unpaid");
|
||||
$response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1&mainmenu=billing&leftmenu=customers_bills';
|
||||
$response->img=img_object('', "bill");
|
||||
|
||||
@ -4230,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)
|
||||
@ -4274,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();
|
||||
@ -4356,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) {
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -1017,8 +1017,8 @@ if ($action == 'create')
|
||||
$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%B').')';
|
||||
$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%B').')';
|
||||
$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B').')';
|
||||
$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y').')';
|
||||
$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%Y').')';
|
||||
$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y').')';
|
||||
$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%Y').')';
|
||||
$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'), '%Y').')';
|
||||
// Only on template invoices
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')';
|
||||
@ -1359,8 +1359,8 @@ else
|
||||
$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B').')';
|
||||
$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%B').')';
|
||||
$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')';
|
||||
$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')';
|
||||
$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')';
|
||||
$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')';
|
||||
$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')';
|
||||
$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y').')';
|
||||
// Only on template invoices
|
||||
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date(($object->date_when?$object->date_when:dol_now()), 'dayhour').')';
|
||||
|
||||
@ -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
|
||||
|
||||
@ -744,6 +744,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $objp, $action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
// Warning
|
||||
print '<td align="center" width="16">';
|
||||
//print "xx".$amounts[$invoice->id]."-".$amountsresttopay[$invoice->id]."<br>";
|
||||
@ -754,9 +757,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printObjectLine', $parameters, $objp, $action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$total+=$objp->total;
|
||||
@ -893,12 +893,13 @@ if (! GETPOST('action', 'aZ09'))
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$objp->facid.'">'.$objp->ref."</a></td>\n";
|
||||
print '<td>'.dol_print_date($db->jdate($objp->dp))."</td>\n";
|
||||
print '<td>'.$objp->paiement_type.' '.$objp->num_paiement."</td>\n";
|
||||
print '<td class="right">'.price($objp->amount).'</td><td> </td>';
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printObjectLine', $parameters, $objp, $action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
print '<td class="right">'.price($objp->amount).'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printObjectLine', $parameters, $objp, $action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
@ -527,6 +527,7 @@ class RemiseCheque extends CommonObject
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay=$conf->bank->cheque->warning_delay/60/60/24;
|
||||
$response->label=$langs->trans("BankChecksToReceipt");
|
||||
$response->labelShort=$langs->trans("BankChecksToReceiptShort");
|
||||
$response->url=DOL_URL_ROOT.'/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank';
|
||||
$response->img=img_object('', "payment");
|
||||
|
||||
|
||||
@ -130,21 +130,6 @@ $AccCat = new AccountancyCategory($db);
|
||||
* View
|
||||
*/
|
||||
|
||||
$months = array(
|
||||
$langs->trans("JanuaryMin"),
|
||||
$langs->trans("FebruaryMin"),
|
||||
$langs->trans("MarchMin"),
|
||||
$langs->trans("AprilMin"),
|
||||
$langs->trans("MayMin"),
|
||||
$langs->trans("JuneMin"),
|
||||
$langs->trans("JulyMin"),
|
||||
$langs->trans("AugustMin"),
|
||||
$langs->trans("SeptemberMin"),
|
||||
$langs->trans("OctoberMin"),
|
||||
$langs->trans("NovemberMin"),
|
||||
$langs->trans("DecemberMin"),
|
||||
);
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
@ -143,18 +143,18 @@ $AccCat = new AccountancyCategory($db);
|
||||
*/
|
||||
|
||||
$months = array(
|
||||
$langs->trans("JanuaryMin"),
|
||||
$langs->trans("FebruaryMin"),
|
||||
$langs->trans("MarchMin"),
|
||||
$langs->trans("AprilMin"),
|
||||
$langs->trans("MayMin"),
|
||||
$langs->trans("JuneMin"),
|
||||
$langs->trans("JulyMin"),
|
||||
$langs->trans("AugustMin"),
|
||||
$langs->trans("SeptemberMin"),
|
||||
$langs->trans("OctoberMin"),
|
||||
$langs->trans("NovemberMin"),
|
||||
$langs->trans("DecemberMin"),
|
||||
$langs->trans("MonthShort01"),
|
||||
$langs->trans("MonthShort02"),
|
||||
$langs->trans("MonthShort03"),
|
||||
$langs->trans("MonthShort04"),
|
||||
$langs->trans("MonthShort05"),
|
||||
$langs->trans("MonthShort06"),
|
||||
$langs->trans("MonthShort07"),
|
||||
$langs->trans("MonthShort08"),
|
||||
$langs->trans("MonthShort09"),
|
||||
$langs->trans("MonthShort10"),
|
||||
$langs->trans("MonthShort11"),
|
||||
$langs->trans("MonthShort12"),
|
||||
);
|
||||
|
||||
llxheader('', $langs->trans('ReportInOut'));
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -96,6 +96,12 @@ class Contrat extends CommonObject
|
||||
*/
|
||||
public $ref_supplier;
|
||||
|
||||
/**
|
||||
* Entity of the contract
|
||||
* @var int
|
||||
*/
|
||||
public $entity;
|
||||
|
||||
/**
|
||||
* Client id linked to the contract
|
||||
* @var int
|
||||
@ -617,13 +623,14 @@ class Contrat extends CommonObject
|
||||
* @param string $ref Ref
|
||||
* @param string $ref_customer Customer ref
|
||||
* @param string $ref_supplier Supplier ref
|
||||
* @return int <0 if KO, 0 if not found, Id of contract if OK
|
||||
* @return int <0 if KO, 0 if not found or if two records found for same ref, Id of contract if OK
|
||||
*/
|
||||
public function fetch($id, $ref = '', $ref_customer = '', $ref_supplier = '')
|
||||
{
|
||||
$sql = "SELECT rowid, statut, ref, fk_soc, mise_en_service as datemise,";
|
||||
$sql.= " ref_supplier, ref_customer,";
|
||||
$sql.= " ref_ext,";
|
||||
$sql.= " entity,";
|
||||
$sql.= " fk_user_mise_en_service, date_contrat as datecontrat,";
|
||||
$sql.= " fk_user_author, fin_validite, date_cloture,";
|
||||
$sql.= " fk_projet as fk_project,";
|
||||
@ -649,57 +656,67 @@ class Contrat extends CommonObject
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
if ($obj)
|
||||
$num=$this->db->num_rows($resql);
|
||||
if ($num > 1)
|
||||
{
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = (!isset($obj->ref) || !$obj->ref) ? $obj->rowid : $obj->ref;
|
||||
$this->ref_customer = $obj->ref_customer;
|
||||
$this->ref_supplier = $obj->ref_supplier;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->statut = $obj->statut;
|
||||
$this->mise_en_service = $this->db->jdate($obj->datemise);
|
||||
|
||||
$this->date_contrat = $this->db->jdate($obj->datecontrat);
|
||||
$this->date_creation = $this->db->jdate($obj->datecontrat);
|
||||
|
||||
$this->fin_validite = $this->db->jdate($obj->fin_validite);
|
||||
$this->date_cloture = $this->db->jdate($obj->date_cloture);
|
||||
|
||||
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
|
||||
$this->commercial_signature_id = $obj->fk_commercial_signature;
|
||||
$this->commercial_suivi_id = $obj->fk_commercial_suivi;
|
||||
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
|
||||
$this->fk_projet = $obj->fk_project; // deprecated
|
||||
$this->fk_project = $obj->fk_project;
|
||||
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->fk_soc = $obj->fk_soc;
|
||||
|
||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
// Retreive all extrafields
|
||||
// fetch optionals attributes and labels
|
||||
$this->fetch_optionals();
|
||||
|
||||
// Lines
|
||||
$result=$this->fetch_lines();
|
||||
if ($result < 0)
|
||||
$this->error='Fetch found several records.';
|
||||
dol_syslog($this->error, LOG_ERR);
|
||||
$result = -2;
|
||||
}
|
||||
elseif ($num) // $num = 1
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return -3;
|
||||
}
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = (!isset($obj->ref) || !$obj->ref) ? $obj->rowid : $obj->ref;
|
||||
$this->ref_customer = $obj->ref_customer;
|
||||
$this->ref_supplier = $obj->ref_supplier;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->entity = $obj->entity;
|
||||
$this->statut = $obj->statut;
|
||||
$this->mise_en_service = $this->db->jdate($obj->datemise);
|
||||
|
||||
return $this->id;
|
||||
$this->date_contrat = $this->db->jdate($obj->datecontrat);
|
||||
$this->date_creation = $this->db->jdate($obj->datecontrat);
|
||||
|
||||
$this->fin_validite = $this->db->jdate($obj->fin_validite);
|
||||
$this->date_cloture = $this->db->jdate($obj->date_cloture);
|
||||
|
||||
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
|
||||
$this->commercial_signature_id = $obj->fk_commercial_signature;
|
||||
$this->commercial_suivi_id = $obj->fk_commercial_suivi;
|
||||
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
|
||||
$this->fk_projet = $obj->fk_project; // deprecated
|
||||
$this->fk_project = $obj->fk_project;
|
||||
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->fk_soc = $obj->fk_soc;
|
||||
|
||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
// Retreive all extrafields
|
||||
// fetch optionals attributes and labels
|
||||
$this->fetch_optionals();
|
||||
|
||||
// Lines
|
||||
$result=$this->fetch_lines();
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return -3;
|
||||
}
|
||||
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2186,23 +2203,27 @@ class Contrat extends CommonObject
|
||||
if ($mode == 'inactive') {
|
||||
$warning_delay = $conf->contrat->services->inactifs->warning_delay;
|
||||
$label = $langs->trans("BoardNotActivatedServices");
|
||||
$labelShort = $langs->trans("BoardNotActivatedServicesShort");
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=0&sortfield=cd.date_fin_validite&sortorder=asc';
|
||||
}
|
||||
elseif ($mode == 'expired') {
|
||||
$warning_delay = $conf->contrat->services->expires->warning_delay;
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired&sortfield=cd.date_fin_validite&sortorder=asc';
|
||||
$label = $langs->trans("BoardExpiredServices");
|
||||
$labelShort = $langs->trans("BoardExpiredServicesShort");
|
||||
} else {
|
||||
$warning_delay = $conf->contrat->services->expires->warning_delay;
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&sortfield=cd.date_fin_validite&sortorder=asc';
|
||||
//$url.= '&op2day='.$arraydatetouse['mday'].'&op2month='.$arraydatetouse['mon'].'&op2year='.$arraydatetouse['year'];
|
||||
//if ($warning_delay >= 0) $url.='&filter=expired';
|
||||
$label = $langs->trans("BoardRunningServices");
|
||||
$labelShort = $langs->trans("BoardRunningServicesShort");
|
||||
}
|
||||
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay = $warning_delay/60/60/24;
|
||||
$response->label = $label;
|
||||
$response->labelShort = $labelShort;
|
||||
$response->url = $url;
|
||||
$response->img = img_object('', "contract");
|
||||
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$hash_unique_id=GETPOST('hash_unique_id', 'alpha');
|
||||
$hash_algo=GETPOST('hash', 'alpha');
|
||||
$hash_algo=GETPOST('hash_algo', 'alpha');
|
||||
|
||||
|
||||
// Security check
|
||||
@ -53,7 +53,7 @@ print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"])
|
||||
// If ok
|
||||
if ($action == 'firstpingok')
|
||||
{
|
||||
// Note: pings are by entities
|
||||
// Note: pings are by installation, done on entity 1.
|
||||
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_DATE', dol_print_date($now, 'dayhourlog', 'gmt'));
|
||||
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_ID', $hash_unique_id);
|
||||
|
||||
@ -62,7 +62,7 @@ if ($action == 'firstpingok')
|
||||
// If ko
|
||||
elseif ($action == 'firstpingko')
|
||||
{
|
||||
// Note: pings are by entities
|
||||
// Note: pings are by installation, done on entity 1.
|
||||
dolibarr_set_const($db, 'MAIN_LAST_PING_KO_DATE', dol_print_date($now, 'dayhourlog'), 'gmt');
|
||||
print 'First ping KO saved for entity '.$conf->entity;
|
||||
}
|
||||
|
||||
@ -31,10 +31,10 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
|
||||
*/
|
||||
class box_task extends ModeleBoxes
|
||||
{
|
||||
public $boxcode="projet";
|
||||
public $boxcode="projettask";
|
||||
public $boximg="object_projecttask";
|
||||
public $boxlabel;
|
||||
//public $depends = array("projet");
|
||||
public $depends = array("projet");
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
@ -42,7 +42,7 @@ class box_task extends ModeleBoxes
|
||||
public $db;
|
||||
|
||||
public $param;
|
||||
public $enabled = 0; // Disabled because bugged.
|
||||
public $enabled = 1; // enable because fixed ;-).
|
||||
|
||||
public $info_box_head = array();
|
||||
public $info_box_contents = array();
|
||||
@ -78,54 +78,110 @@ class box_task extends ModeleBoxes
|
||||
global $conf, $user, $langs, $db;
|
||||
|
||||
$this->max=$max;
|
||||
|
||||
$totalMnt = 0;
|
||||
$totalnb = 0;
|
||||
$totalDuree=0;
|
||||
$totalplannedtot=0;
|
||||
$totaldurationtot=0;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT."/projet/class/task.class.php";
|
||||
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/project.lib.php";
|
||||
$projectstatic = new Project($this->db);
|
||||
$taskstatic=new Task($db);
|
||||
$form= new Form($db);
|
||||
$cookie_name='boxfilter_task';
|
||||
$boxcontent='';
|
||||
|
||||
$textHead = $langs->trans("CurentlyOpenedTasks");
|
||||
|
||||
$filterValue='all';
|
||||
if(in_array(GETPOST($cookie_name), array('all','im_project_contact','im_task_contact'))){
|
||||
$filterValue = GETPOST($cookie_name);
|
||||
}
|
||||
elseif(!empty($_COOKIE[$cookie_name])){
|
||||
$filterValue = $_COOKIE[$cookie_name];
|
||||
}
|
||||
|
||||
|
||||
$textHead = $langs->trans("Tasks")." ".date("Y");
|
||||
$this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead));
|
||||
if($filterValue == 'im_task_contact'){
|
||||
$textHead.= ' : '.$langs->trans("WhichIamLinkedTo");
|
||||
}
|
||||
elseif($filterValue == 'im_project_contact'){
|
||||
$textHead.= ' : '.$langs->trans("WhichIamLinkedToProject");
|
||||
}
|
||||
|
||||
|
||||
$this->info_box_head = array(
|
||||
'text' => $textHead,
|
||||
'limit'=> dol_strlen($textHead),
|
||||
'sublink'=>'',
|
||||
'subtext'=>$langs->trans("Filter"),
|
||||
'subpicto'=>'filter.png',
|
||||
'subclass'=>'linkobject boxfilter',
|
||||
'target'=>'none' // Set '' to get target="_blank"
|
||||
);
|
||||
|
||||
// list the summary of the orders
|
||||
if ($user->rights->projet->lire) {
|
||||
// FIXME fk_statut on a task is not be used. We use the percent. This means this box is useless.
|
||||
$sql = "SELECT pt.fk_statut, count(DISTINCT pt.rowid) as nb, sum(ptt.task_duration) as durationtot, sum(pt.planned_workload) as plannedtot";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_time as ptt";
|
||||
$sql.= " WHERE pt.datec BETWEEN '".$this->db->idate(dol_get_first_day(date("Y"), 1))."' AND '".$this->db->idate(dol_get_last_day(date("Y"), 12))."'";
|
||||
$sql.= " AND pt.rowid = ptt.fk_task";
|
||||
$sql.= " GROUP BY pt.fk_statut ";
|
||||
$sql.= " ORDER BY pt.fk_statut DESC";
|
||||
$boxcontent.= '<div id="ancor-idfilter'.$this->boxcode.'" style="display: block; position: absolute; margin-top: -100px"></div>'."\n";
|
||||
$boxcontent.= '<div id="idfilter'.$this->boxcode.'" class="hideobject center" >'."\n";
|
||||
$boxcontent.= '<form class="flat " method="POST" action="'.$_SERVER["PHP_SELF"].'#ancor-idfilter'.$this->boxcode.'">'."\n";
|
||||
$boxcontent.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
||||
$selectArray = array('all' => $langs->trans("NoFilter"), 'im_task_contact' => $langs->trans("WhichIamLinkedTo"), 'im_project_contact' => $langs->trans("WhichIamLinkedToProject"));
|
||||
$boxcontent.= $form->selectArray($cookie_name, $selectArray, $filterValue);
|
||||
$boxcontent.= '<button type="submit" >'.$langs->trans("Change").'</button>';
|
||||
$boxcontent.= '</form>'."\n";
|
||||
$boxcontent.= '</div>'."\n";
|
||||
$boxcontent.= '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#idsubimg'.$this->boxcode.'").click(function() {
|
||||
jQuery("#idfilter'.$this->boxcode.'").toggle();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
|
||||
$sql = "SELECT pt.rowid, pt.ref, pt.fk_projet, pt.fk_task_parent, pt.datec, pt.dateo, pt.datee, pt.datev, pt.label, pt.description, pt.duration_effective, pt.planned_workload, pt.progress";
|
||||
$sql.= ", p.rowid project_id, p.ref project_ref, p.title project_title";
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."projet as p ON (pt.fk_projet = p.rowid)";
|
||||
|
||||
if($filterValue === 'im_task_contact') {
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "element_contact as ec ON (ec.element_id = pt.rowid AND ec.fk_socpeople = '" . $user->id . "' )";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "c_type_contact as tc ON (ec.fk_c_type_contact = tc.rowid AND tc.element = 'project_task' AND tc.source = 'internal' )";
|
||||
}
|
||||
elseif($filterValue === 'im_project_contact') {
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "element_contact as ec ON (ec.element_id = p.rowid AND ec.fk_socpeople = '" . $user->id . "' )";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "c_type_contact as tc ON (ec.fk_c_type_contact = tc.rowid AND tc.element = 'project' AND tc.source = 'internal' )";
|
||||
}
|
||||
|
||||
$sql.= " WHERE ";
|
||||
$sql.= " pt.entity = ".$conf->entity;
|
||||
$sql.= " AND p.fk_statut = ".Project::STATUS_VALIDATED;
|
||||
$sql.= " AND (pt.progress < 100 OR pt.progress IS NULL ) "; // 100% is done and not displayed
|
||||
|
||||
$sql.= " ORDER BY pt.datee ASC, pt.dateo ASC";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
$i = 0;
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => '',
|
||||
'text' =>$langs->trans("Task")." ".$taskstatic->LibStatut($objp->fk_statut, 0),
|
||||
);
|
||||
while ($objp = $db->fetch_object($result)) {
|
||||
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $objp->nb." ".$langs->trans("Tasks"),
|
||||
'url' => DOL_URL_ROOT."/projet/tasks/list.php?leftmenu=projects&viewstatut=".$objp->fk_statut,
|
||||
);
|
||||
$totalnb += $objp->nb;
|
||||
$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => ConvertSecondToTime($objp->plannedtot, 'all', 25200, 5));
|
||||
$totalplannedtot += $objp->plannedtot;
|
||||
$this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => ConvertSecondToTime($objp->durationtot, 'all', 25200, 5));
|
||||
$totaldurationtot += $objp->durationtot;
|
||||
$taskstatic->id=$objp->rowid;
|
||||
$taskstatic->ref=$objp->ref;
|
||||
$taskstatic->label=$objp->label;
|
||||
$taskstatic->progress = $objp->progress;
|
||||
$taskstatic->fk_statut = $objp->fk_statut;
|
||||
$taskstatic->date_end = $objp->datee;
|
||||
$taskstatic->planned_workload= $objp->planned_workload;
|
||||
$taskstatic->duration_effective= $objp->duration_effective;
|
||||
|
||||
$this->info_box_contents[$i][] = array('td' => 'class="right" width="18"', 'text' => $taskstatic->LibStatut($objp->fk_statut, 3));
|
||||
$projectstatic->id = $objp->project_id;
|
||||
$projectstatic->ref = $objp->project_ref;
|
||||
$projectstatic->title = $objp->project_title;
|
||||
|
||||
$label = $projectstatic->getNomUrl(1).' '.$taskstatic->getNomUrl(1).' '.dol_htmlentities($taskstatic->label);
|
||||
|
||||
$boxcontent.= getTaskProgressView($taskstatic, $label, true, false, true);
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -134,12 +190,15 @@ class box_task extends ModeleBoxes
|
||||
}
|
||||
}
|
||||
|
||||
// Add the sum at the bottom of the boxes
|
||||
$this->info_box_contents[$i][] = array('tr' => 'class="liste_total"', 'td' => '', 'text' => $langs->trans("Total")." ".$textHead);
|
||||
$this->info_box_contents[$i][] = array('td' => 'class="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Tasks"));
|
||||
$this->info_box_contents[$i][] = array('td' => 'class="right" ', 'text' => ConvertSecondToTime($totalplannedtot, 'all', 25200, 5));
|
||||
$this->info_box_contents[$i][] = array('td' => 'class="right" ', 'text' => ConvertSecondToTime($totaldurationtot, 'all', 25200, 5));
|
||||
$this->info_box_contents[$i][] = array('td' => '', 'text' => "");
|
||||
// set cookie by js
|
||||
if(empty($i)){
|
||||
$boxcontent.='<script >date = new Date(); date.setTime(date.getTime()+(30*86400000)); document.cookie = "'.$cookie_name.'='.$filterValue.'; expires= " + date.toGMTString() + "; path=/ "; </script>';
|
||||
}
|
||||
|
||||
$this->info_box_contents[0][] = array(
|
||||
'td' => '',
|
||||
'text' => $boxcontent,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -566,6 +569,9 @@ class Conf
|
||||
// By default, we show state code in combo list
|
||||
if (! isset($this->global->MAIN_SHOW_STATE_CODE)) $this->global->MAIN_SHOW_STATE_CODE=1;
|
||||
|
||||
// Use a SCA ready workflow with Stripe module (STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION by default if nothing defined)
|
||||
if (! isset($this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) && empty($this->global->STRIPE_USE_NEW_CHECKOUT)) $this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=1;
|
||||
|
||||
// Define list of limited modules (value must be key found for "name" property of module, so for example 'supplierproposal' for Module "Supplier Proposal"
|
||||
if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,societe,propal,commande,facture,categorie,supplierproposal,fournisseur,contact,projet,contrat,ficheinter,expedition,agenda,resource,adherent,blockedlog'; // '' means 'all'. Note that contact is added here as it should be a module later.
|
||||
if (! empty($this->modules_parts['moduleforexternal'])) // Module part to include an external module into the MAIN_MODULES_FOR_EXTERNAL list
|
||||
|
||||
@ -43,15 +43,30 @@ class DolGeoIP
|
||||
*/
|
||||
public function __construct($type, $datfile)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$geoipversion = '2'; // 'php', '1' or '2'
|
||||
if (! empty($conf->global->GEOIP_VERSION)) $geoipversion = $conf->global->GEOIP_VERSION;
|
||||
|
||||
if ($type == 'country')
|
||||
{
|
||||
// geoip may have been already included with PEAR
|
||||
if (! function_exists('geoip_country_code_by_name')) $res=include_once GEOIP_PATH.'geoip.inc';
|
||||
if ($geoipversion == '2' || ($geoipversion != 'php' && ! function_exists('geoip_country_code_by_name')))
|
||||
{
|
||||
if ($geoipversion == '1') $res=include_once GEOIP_PATH.'geoip.inc';
|
||||
//else $res=include_once DOL_DOCUMENT_ROOT.'/includes/geoip2/vendor/autoload.php';
|
||||
else require_once DOL_DOCUMENT_ROOT.'/includes/geoip2/geoip2.phar';
|
||||
}
|
||||
}
|
||||
elseif ($type == 'city')
|
||||
{
|
||||
// geoip may have been already included with PEAR
|
||||
if (! function_exists('geoip_country_code_by_name')) $res=include_once GEOIP_PATH.'geoipcity.inc';
|
||||
if ($geoipversion == '2' || ($geoipversion != 'php' && ! function_exists('geoip_country_code_by_name')))
|
||||
{
|
||||
if ($geoipversion == '1') $res=include_once GEOIP_PATH.'geoipcity.inc';
|
||||
//else $res=include_once DOL_DOCUMENT_ROOT.'/includes/geoip2/vendor/autoload.php';
|
||||
else require_once DOL_DOCUMENT_ROOT.'/includes/geoip2/geoip2.phar';
|
||||
}
|
||||
}
|
||||
else { print 'ErrorBadParameterInConstructor'; return 0; }
|
||||
|
||||
@ -70,7 +85,19 @@ class DolGeoIP
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (function_exists('geoip_open'))
|
||||
if ($geoipversion == '2')
|
||||
{
|
||||
try {
|
||||
$this->gi = new GeoIp2\Database\Reader($datfile); // '/usr/local/share/GeoIP/GeoIP2-City.mmdb'
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
$this->error = $e->getMessage();
|
||||
dol_syslog('DolGeoIP '.$this->errorlabel, LOG_ERR);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
elseif (function_exists('geoip_open'))
|
||||
{
|
||||
$this->gi = geoip_open($datfile, GEOIP_STANDARD);
|
||||
}
|
||||
@ -90,6 +117,11 @@ class DolGeoIP
|
||||
*/
|
||||
public function getCountryCodeFromIP($ip)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$geoipversion = '2'; // 'php', '1' or '2'
|
||||
if (! empty($conf->global->GEOIP_VERSION)) $geoipversion = $conf->global->GEOIP_VERSION;
|
||||
|
||||
if (empty($this->gi))
|
||||
{
|
||||
return '';
|
||||
@ -101,8 +133,44 @@ class DolGeoIP
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! function_exists('geoip_country_code_by_addr')) return strtolower(geoip_country_code_by_name($this->gi, $ip));
|
||||
return strtolower(geoip_country_code_by_addr($this->gi, $ip));
|
||||
if (preg_match('/^[0-9]+.[0-9]+\.[0-9]+\.[0-9]+/', $ip))
|
||||
{
|
||||
if ($geoipversion == '2')
|
||||
{
|
||||
try {
|
||||
$record = $this->gi->country($ip);
|
||||
return strtolower($record->country->isoCode);
|
||||
}
|
||||
catch(Exception $e) {
|
||||
//return $e->getMessage();
|
||||
return '';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! function_exists('geoip_country_code_by_addr')) return strtolower(geoip_country_code_by_name($this->gi, $ip));
|
||||
return strtolower(geoip_country_code_by_addr($this->gi, $ip));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($geoipversion == '2')
|
||||
{
|
||||
try {
|
||||
$record = $this->gi->country($ip);
|
||||
return strtolower($record->country->isoCode);
|
||||
}
|
||||
catch(Exception $e) {
|
||||
//return $e->getMessage();
|
||||
return '';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! function_exists('geoip_country_code_by_addr_v6')) return strtolower(geoip_country_code_by_name_v6($this->gi, $ip));
|
||||
return strtolower(geoip_country_code_by_addr_v6($this->gi, $ip));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,11 +182,31 @@ class DolGeoIP
|
||||
*/
|
||||
public function getCountryCodeFromName($name)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$geoipversion = '2'; // 'php', '1' or '2'
|
||||
if (! empty($conf->global->GEOIP_VERSION)) $geoipversion = $conf->global->GEOIP_VERSION;
|
||||
|
||||
if (empty($this->gi))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
return geoip_country_code_by_name($this->gi, $name);
|
||||
|
||||
if ($geoipversion == '2')
|
||||
{
|
||||
try {
|
||||
$record = $this->gi->country($name);
|
||||
return $record->country->isoCode;
|
||||
}
|
||||
catch(Exception $e) {
|
||||
//return $e->getMessage();
|
||||
return '';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return geoip_country_code_by_name($this->gi, $name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -128,8 +216,18 @@ class DolGeoIP
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
if ($this->gi == 'NOGI') return geoip_database_info();
|
||||
return 'Not available (not using PHP internal geo functions)';
|
||||
global $conf;
|
||||
|
||||
$geoipversion = '2'; // 'php', '1' or '2'
|
||||
if (! empty($conf->global->GEOIP_VERSION)) $geoipversion = $conf->global->GEOIP_VERSION;
|
||||
|
||||
if ($geoipversion == 'php')
|
||||
{
|
||||
if ($this->gi == 'NOGI') return geoip_database_info();
|
||||
else return 'geoip_database_info() function not available';
|
||||
}
|
||||
|
||||
return 'Not available (not using PHP internal geo functions - We are using embedded Geoip v'.$geoipversion.')';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1628,7 +1628,7 @@ class ExtraFields
|
||||
if ($hidden) return ''; // This is a protection. If field is hidden, we should just not call this method.
|
||||
|
||||
//if ($computed) $value = // $value is already calculated into $value before calling this method
|
||||
|
||||
|
||||
$showsize=0;
|
||||
if ($type == 'date')
|
||||
{
|
||||
@ -1972,24 +1972,29 @@ class ExtraFields
|
||||
if (count($extrafield_param_list) > 0) {
|
||||
$extrafield_collapse_display_value = intval($extrafield_param_list[0]);
|
||||
if ($extrafield_collapse_display_value == 1 || $extrafield_collapse_display_value == 2) {
|
||||
$collapse_display = ($extrafield_collapse_display_value == 2 ? false : true);
|
||||
// Set the collapse_display status to cookie in priority or if ignorecollapsesetup is 1, if cookie and ignorecollapsesetup not defined, use the setup.
|
||||
$collapse_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) || GETPOST('ignorecollapsesetup', 'int')) ? ($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key] ? true : false) : ($extrafield_collapse_display_value == 2 ? false : true));
|
||||
$extrafields_collapse_num = $this->attributes[$object->table_element]['pos'][$key];
|
||||
|
||||
$out .= '<!-- Add js script to manage the collpase/uncollapse of extrafields separators '.$key.' -->';
|
||||
$out .= '<script type="text/javascript">';
|
||||
$out .= 'jQuery(document).ready(function(){';
|
||||
if ($collapse_display === false) {
|
||||
$out .= ' jQuery("#trextrafieldseparator' . $key . ' td").prepend("<span class=\"cursorpointer fa fa-plus-square\"></span> ");';
|
||||
$out .= ' jQuery(".trextrafields_collapse' . $extrafields_collapse_num . '").hide();';
|
||||
$out .= ' jQuery("#trextrafieldseparator' . $key . ' td").prepend("<span class=\"cursorpointer fa fa-plus-square\"></span> ");'."\n";
|
||||
$out .= ' jQuery(".trextrafields_collapse' . $extrafields_collapse_num . '").hide();'."\n";
|
||||
} else {
|
||||
$out .= ' jQuery("#trextrafieldseparator' . $key . ' td").prepend("<span class=\"cursorpointer fa fa-minus-square\"></span> ");';
|
||||
$out .= ' jQuery("#trextrafieldseparator' . $key . ' td").prepend("<span class=\"cursorpointer fa fa-minus-square\"></span> ");'."\n";
|
||||
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=1; path='.$_SERVER["PHP_SELF"].'"'."\n";
|
||||
}
|
||||
$out .= ' jQuery("#trextrafieldseparator' . $key . '").click(function(){';
|
||||
$out .= ' jQuery(".trextrafields_collapse' . $extrafields_collapse_num . '").toggle("slow", function(){';
|
||||
$out .= ' if (jQuery(".trextrafields_collapse' . $extrafields_collapse_num . '").is(":hidden")) {';
|
||||
$out .= ' jQuery("#trextrafieldseparator' . $key . ' td span").addClass("fa-plus-square").removeClass("fa-minus-square");';
|
||||
$out .= ' } else {';
|
||||
$out .= ' jQuery("#trextrafieldseparator' . $key . ' td span").addClass("fa-minus-square").removeClass("fa-plus-square");';
|
||||
$out .= ' }';
|
||||
$out .= ' jQuery("#trextrafieldseparator' . $key . '").click(function(){'."\n";
|
||||
$out .= ' jQuery(".trextrafields_collapse' . $extrafields_collapse_num . '").toggle(300, function(){'."\n";
|
||||
$out .= ' if (jQuery(".trextrafields_collapse' . $extrafields_collapse_num . '").is(":hidden")) {'."\n";
|
||||
$out .= ' jQuery("#trextrafieldseparator' . $key . ' td span").addClass("fa-plus-square").removeClass("fa-minus-square");'."\n";
|
||||
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=0; path='.$_SERVER["PHP_SELF"].'"'."\n";
|
||||
$out .= ' } else {'."\n";
|
||||
$out .= ' jQuery("#trextrafieldseparator' . $key . ' td span").addClass("fa-minus-square").removeClass("fa-plus-square");'."\n";
|
||||
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=1; path='.$_SERVER["PHP_SELF"].'"'."\n";
|
||||
$out .= ' }'."\n";
|
||||
$out .= ' });';
|
||||
$out .= ' });';
|
||||
$out .= '});';
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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:'').'>';
|
||||
|
||||
3886
htdocs/core/class/lessc.class.php
Normal file
3886
htdocs/core/class/lessc.class.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||
|
||||
@ -37,6 +37,18 @@ class WorkboardResponse
|
||||
*/
|
||||
public $label;
|
||||
|
||||
/**
|
||||
* Short Label of the warning
|
||||
* @var string
|
||||
*/
|
||||
public $labelShort;
|
||||
|
||||
/**
|
||||
* infoKey of the warning
|
||||
* @var string
|
||||
*/
|
||||
public $infoKey = 'todo';
|
||||
|
||||
/**
|
||||
* URL to list to do items
|
||||
* @var string
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -172,7 +172,8 @@ function societe_prepare_head(Societe $object)
|
||||
}
|
||||
|
||||
// Related items
|
||||
if (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->ficheinter->enabled) || ! empty($conf->fournisseur->enabled))
|
||||
if ((! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->ficheinter->enabled) || ! empty($conf->fournisseur->enabled))
|
||||
&& empty($conf->global->THIRPARTIES_DISABLE_RELATED_OBJECT_TAB))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Referers");
|
||||
@ -1241,7 +1242,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
||||
if (! empty($conf->agenda->enabled))
|
||||
{
|
||||
// Recherche histo sur actioncomm
|
||||
if (is_object($objcon) && $objcon->id) {
|
||||
if (is_object($objcon) && $objcon->id > 0) {
|
||||
$sql = "SELECT DISTINCT a.id, a.label as label,";
|
||||
}
|
||||
else
|
||||
@ -1267,7 +1268,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
|
||||
|
||||
$force_filter_contact = false;
|
||||
if (is_object($objcon) && $objcon->id) {
|
||||
if (is_object($objcon) && $objcon->id > 0) {
|
||||
$force_filter_contact = true;
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as r ON a.id = r.fk_actioncomm";
|
||||
$sql.= " AND r.element_type = '" . $db->escape($objcon->table_element) . "' AND r.fk_element = " . $objcon->id;
|
||||
|
||||
@ -986,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'])
|
||||
@ -1064,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;
|
||||
@ -1889,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1942,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';
|
||||
@ -2200,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]))
|
||||
@ -2212,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))
|
||||
@ -2388,7 +2452,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
|
||||
// Wrapping for third parties
|
||||
elseif (($modulepart == 'company' || $modulepart == 'societe') && !empty($conf->societe->dir_output))
|
||||
elseif (($modulepart == 'company' || $modulepart == 'societe' || $modulepart == 'thirdparty') && !empty($conf->societe->dir_output))
|
||||
{
|
||||
if (empty($entity) || empty($conf->societe->multidir_output[$entity])) return array('accessallowed'=>0, 'error'=>'Value entity must be provided');
|
||||
if ($fuser->rights->societe->{$lire} || preg_match('/^specimen/i', $original_file))
|
||||
@ -2411,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
|
||||
@ -2435,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')
|
||||
{
|
||||
@ -2527,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;
|
||||
}
|
||||
|
||||
@ -2856,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;
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -974,10 +995,11 @@ function dol_strtoupper($utf8_string)
|
||||
* On Linux LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7
|
||||
* @param int $ident 1=Increase ident of 1, -1=Decrease ident of 1
|
||||
* @param string $suffixinfilename When output is a file, append this suffix into default log filename.
|
||||
* @param string $restricttologhandler Output log only for this log handler
|
||||
* @param string $restricttologhandler Force output of log only to this log handler
|
||||
* @param array|null $logcontext If defined, an array with extra informations (can be used by some log handlers)
|
||||
* @return void
|
||||
*/
|
||||
function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename = '', $restricttologhandler = '')
|
||||
function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename = '', $restricttologhandler = '', $logcontext = null)
|
||||
{
|
||||
global $conf, $user, $debugbar;
|
||||
|
||||
@ -1208,7 +1230,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
|
||||
}
|
||||
if ($popuptab) $outmore.='</div>';
|
||||
|
||||
if ($displaytab > $limittoshow)
|
||||
if ($popuptab) // If there is some tabs not shown
|
||||
{
|
||||
$left=($langs->trans("DIRECTION") == 'rtl'?'right':'left');
|
||||
$right=($langs->trans("DIRECTION") == 'rtl'?'left':'right');
|
||||
@ -2631,6 +2653,10 @@ function dol_print_ip($ip, $mode = 0)
|
||||
}
|
||||
else $ret.=' ('.$countrycode.')';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nothing
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
@ -2666,12 +2692,10 @@ function dolGetCountryCodeFromIp($ip)
|
||||
{
|
||||
$datafile=$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE;
|
||||
//$ip='24.24.24.24';
|
||||
//$datafile='E:\Mes Sites\Web\Admin1\awstats\maxmind\GeoIP.dat'; Note that this must be downloaded datafile (not same than datafile provided with ubuntu packages)
|
||||
|
||||
//$datafile='/usr/share/GeoIP/GeoIP.dat'; Note that this must be downloaded datafile (not same than datafile provided with ubuntu packages)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgeoip.class.php';
|
||||
$geoip=new DolGeoIP('country', $datafile);
|
||||
//print 'ip='.$ip.' databaseType='.$geoip->gi->databaseType." GEOIP_CITY_EDITION_REV1=".GEOIP_CITY_EDITION_REV1."\n";
|
||||
//print "geoip_country_id_by_addr=".geoip_country_id_by_addr($geoip->gi,$ip)."\n";
|
||||
$countrycode=$geoip->getCountryCodeFromIP($ip);
|
||||
}
|
||||
|
||||
@ -3204,7 +3228,7 @@ function img_object($titlealt, $picto, $moreatt = '', $pictoisfullpath = false,
|
||||
* Show weather picto
|
||||
*
|
||||
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
||||
* @param string $picto Name of image file to show (If no extension provided, we use '.png'). Image must be stored into htdocs/theme/common directory.
|
||||
* @param string|int $picto Name of image file to show (If no extension provided, we use '.png'). Image must be stored into htdocs/theme/common directory. Or level of meteo image (0-4).
|
||||
* @param string $moreatt Add more attribute on img tag
|
||||
* @param int $pictoisfullpath If 1, image path is a full path
|
||||
* @param string $morecss More CSS
|
||||
@ -3215,7 +3239,13 @@ function img_weather($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $mo
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (! preg_match('/(\.png|\.gif)$/i', $picto)) $picto .= '.png';
|
||||
if (is_numeric($picto))
|
||||
{
|
||||
$leveltopicto=array(0=>'weather-clear.png', 1=>'weather-few-clouds.png', 2=>'weather-clouds.png', 3=>'weather-many-clouds.png', 4=>'weather-storm.png');
|
||||
//return '<i class="fa fa-weather-level'.$picto.'"></i>';
|
||||
$picto = $leveltopicto[$picto];
|
||||
}
|
||||
elseif (! preg_match('/(\.png|\.gif)$/i', $picto)) $picto .= '.png';
|
||||
|
||||
$path = DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/weather/'.$picto;
|
||||
|
||||
@ -6371,10 +6401,11 @@ function setEventMessage($mesgs, $style = 'mesgs')
|
||||
* @param string $mesg Message string
|
||||
* @param array $mesgs Message array
|
||||
* @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors')
|
||||
* @param string $messagekey A key to be used to allow the feature "Never show this message again"
|
||||
* @return void
|
||||
* @see dol_htmloutput_events()
|
||||
*/
|
||||
function setEventMessages($mesg, $mesgs, $style = 'mesgs')
|
||||
function setEventMessages($mesg, $mesgs, $style = 'mesgs', $messagekey = '')
|
||||
{
|
||||
if (empty($mesg) && empty($mesgs))
|
||||
{
|
||||
@ -6382,12 +6413,21 @@ function setEventMessages($mesg, $mesgs, $style = 'mesgs')
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! in_array((string) $style, array('mesgs','warnings','errors'))) dol_print_error('', 'Bad parameter style='.$style.' for setEventMessages');
|
||||
if (empty($mesgs)) setEventMessage($mesg, $style);
|
||||
else
|
||||
if ($messagekey)
|
||||
{
|
||||
if (! empty($mesg) && ! in_array($mesg, $mesgs)) setEventMessage($mesg, $style); // Add message string if not already into array
|
||||
setEventMessage($mesgs, $style);
|
||||
// Complete message with a js link to set a cookie "DOLHIDEMESSAGE".$messagekey;
|
||||
// TODO
|
||||
$mesg.='';
|
||||
}
|
||||
if (empty($messagekey) || empty($_COOKIE["DOLHIDEMESSAGE".$messagekey]))
|
||||
{
|
||||
if (! in_array((string) $style, array('mesgs','warnings','errors'))) dol_print_error('', 'Bad parameter style='.$style.' for setEventMessages');
|
||||
if (empty($mesgs)) setEventMessage($mesg, $style);
|
||||
else
|
||||
{
|
||||
if (! empty($mesg) && ! in_array($mesg, $mesgs)) setEventMessage($mesg, $style); // Add message string if not already into array
|
||||
setEventMessage($mesgs, $style);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2199,7 +2199,7 @@ function fetchObjectByElement($element_id, $element_type, $element_ref = '')
|
||||
* @param array $arraycolor Array
|
||||
* @param string $colorifnotfound Color code to return if entry not defined or not a RGB format
|
||||
* @return string RGB hex value (without # before). For example: 'FF00FF', '01FF02'
|
||||
* @see colorStringToArray()
|
||||
* @see colorStringToArray(), colorHexToRgb()
|
||||
*/
|
||||
function colorArrayToHex($arraycolor, $colorifnotfound = '888888')
|
||||
{
|
||||
@ -2216,7 +2216,7 @@ function colorArrayToHex($arraycolor, $colorifnotfound = '888888')
|
||||
* @param string $stringcolor String with hex (FFFFFF) or comma RGB ('255,255,255')
|
||||
* @param array $colorifnotfound Color code array to return if entry not defined
|
||||
* @return array RGB hex value (without # before). For example: FF00FF
|
||||
* @see colorArrayToHex()
|
||||
* @see colorArrayToHex(), colorHexToRgb()
|
||||
*/
|
||||
function colorStringToArray($stringcolor, $colorifnotfound = array(88,88,88))
|
||||
{
|
||||
@ -2233,13 +2233,12 @@ function colorStringToArray($stringcolor, $colorifnotfound = array(88,88,88))
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $color the color you need to valid
|
||||
* @param boolean $allow_white in case of white isn't valid
|
||||
* @param string $color the color you need to valid
|
||||
* @param boolean $allow_white in case of white isn't valid
|
||||
* @return boolean
|
||||
*/
|
||||
function colorValidateHex($color, $allow_white = true)
|
||||
{
|
||||
|
||||
if(!$allow_white && ($color === '#fff' || $color === '#ffffff') ) return false;
|
||||
|
||||
if(preg_match('/^#[a-f0-9]{6}$/i', $color)) //hex color is valid
|
||||
@ -2249,11 +2248,54 @@ function colorValidateHex($color, $allow_white = true)
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change color to make it less aggressive (ratio is negative) or more aggressive (ratio is positive)
|
||||
*
|
||||
* @param string $hex Color in hex ('#AA1122' or 'AA1122' or '#a12' or 'a12')
|
||||
* @param integer $ratio Default=-50. Note: 0=Component color is unchanged, -100=Component color become 88, +100=Component color become 00 or FF
|
||||
* @return string New string of color
|
||||
* @see colorAdjustBrightness()
|
||||
*/
|
||||
function colorAgressivity($hex, $ratio = -50)
|
||||
{
|
||||
// Steps should be between -255 and 255. Negative = darker, positive = lighter
|
||||
$ratio = max(-100, min(100, $ratio));
|
||||
|
||||
// Normalize into a six character long hex string
|
||||
$hex = str_replace('#', '', $hex);
|
||||
if (strlen($hex) == 3) {
|
||||
$hex = str_repeat(substr($hex, 0, 1), 2).str_repeat(substr($hex, 1, 1), 2).str_repeat(substr($hex, 2, 1), 2);
|
||||
}
|
||||
|
||||
// Split into three parts: R, G and B
|
||||
$color_parts = str_split($hex, 2);
|
||||
$return = '#';
|
||||
|
||||
foreach ($color_parts as $color) {
|
||||
$color = hexdec($color); // Convert to decimal
|
||||
if ($ratio > 0) // We increase aggressivity
|
||||
{
|
||||
if ($color > 127) $color += ((255 - $color) * ($ratio / 100));
|
||||
if ($color < 128) $color -= ($color * ($ratio / 100));
|
||||
}
|
||||
else // We decrease agressivity
|
||||
{
|
||||
if ($color > 128) $color -= (($color - 128) * (abs($ratio) / 100));
|
||||
if ($color < 127) $color += ((128 - $color) * (abs($ratio) / 100));
|
||||
}
|
||||
$color = max(0, min(255, $color)); // Adjust color
|
||||
$return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code
|
||||
}
|
||||
|
||||
//var_dump($hex.' '.$ratio.' -> '.$return);
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $hex color in hex
|
||||
* @param integer $steps Steps should be between -255 and 255. Negative = darker, positive = lighter
|
||||
* @return string
|
||||
* @param string $hex Color in hex ('#AA1122' or 'AA1122' or '#a12' or 'a12')
|
||||
* @param integer $steps Step/offset added to each color component. It should be between -255 and 255. Negative = darker, positive = lighter
|
||||
* @return string New color with format '#AA1122'
|
||||
* @see colorAgressivity()
|
||||
*/
|
||||
function colorAdjustBrightness($hex, $steps)
|
||||
{
|
||||
@ -2303,10 +2345,10 @@ function colorLighten($hex, $percent)
|
||||
|
||||
|
||||
/**
|
||||
* @param string $hex color in hex
|
||||
* @param float $alpha 0 to 1
|
||||
* @param bool $returnArray set to 1 to return an array instead of string
|
||||
* @return string|array
|
||||
* @param string $hex color in hex
|
||||
* @param float $alpha 0 to 1 to add alpha channel
|
||||
* @param bool $returnArray Array set to 1 to return an array instead of string
|
||||
* @return string|array String or array
|
||||
*/
|
||||
function colorHexToRgb($hex, $alpha = false, $returnArray = false)
|
||||
{
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -457,6 +457,9 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
$taskstatic->progress = $lines[$i]->progress;
|
||||
$taskstatic->fk_statut = $lines[$i]->status;
|
||||
$taskstatic->datee = $lines[$i]->date_end;
|
||||
$taskstatic->planned_workload= $lines[$i]->planned_workload;
|
||||
$taskstatic->duration_effective= $lines[$i]->duration;
|
||||
|
||||
|
||||
if ($showproject)
|
||||
{
|
||||
@ -556,10 +559,15 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
print '<td class="right">';
|
||||
if ($lines[$i]->progress != '')
|
||||
{
|
||||
print $lines[$i]->progress.' %';
|
||||
print getTaskProgressBadge($taskstatic);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// resume
|
||||
print '<td class="right">';
|
||||
print getTaskProgressView($taskstatic, false, false);
|
||||
print '</td>';
|
||||
|
||||
if ($showbilltime)
|
||||
{
|
||||
// Time not billed
|
||||
@ -1943,3 +1951,164 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
|
||||
print '</table></form>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param task $task Task the task object
|
||||
* @param label $label bool|string true = auto, false = dont display, string = replace output
|
||||
* @param progressNumber $progressNumber bool|string true = auto, false = dont display, string = replace output
|
||||
* @param hideOnProgressNull $hideOnProgressNull bool hide if progress is null
|
||||
* @param spaced $spaced bool used to add space at bottom (made by css)
|
||||
* @return string
|
||||
*/
|
||||
function getTaskProgressView($task, $label = true, $progressNumber = true, $hideOnProgressNull = false, $spaced = false)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$out = '';
|
||||
|
||||
$plannedworkloadoutputformat='allhourmin';
|
||||
$timespentoutputformat='allhourmin';
|
||||
if (! empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat=$conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
|
||||
if (! empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat=$conf->global->PROJECT_TIME_SPENT_FORMAT;
|
||||
|
||||
if(empty($task->progress) && !empty($hideOnProgressNull)){
|
||||
return '';
|
||||
}
|
||||
|
||||
$spaced = !empty($spaced)?'spaced':'';
|
||||
|
||||
$diff = '';
|
||||
|
||||
// define progress color according to time spend vs workload
|
||||
$progressBarClass = 'progress-bar-info';
|
||||
if ($task->planned_workload){
|
||||
$progressCalculated = round(100 * doubleval($task->duration_effective) / doubleval($task->planned_workload), 2);
|
||||
|
||||
// this conf is actually hidden, by default we use 1% for "be carefull or warning"
|
||||
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.01;
|
||||
|
||||
$diffTitle = '<br/>'.$langs->trans('ProgressDeclared').' : '.$task->progress.'%';
|
||||
$diffTitle.= '<br/>'.$langs->trans('ProgressCalculated').' : '.$progressCalculated.'%';
|
||||
|
||||
if($progressCalculated > doubleval($task->progress)){
|
||||
$progressBarClass = 'progress-bar-danger';
|
||||
$title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).'%');
|
||||
$diff = '<span class="text-danger classfortooltip"" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-down"></i> '.($task->progress-$progressCalculated).'%</span>';
|
||||
}
|
||||
elseif($progressCalculated * $warningRatio >= doubleval($task->progress)){ // warning if close at 1%
|
||||
$progressBarClass = 'progress-bar-warning';
|
||||
$title = $langs->trans('TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress-$progressCalculated).'%');
|
||||
$diff = '<span class="text-warning classfortooltip" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-left"></i> '.($task->progress-$progressCalculated).'%</span>';
|
||||
}
|
||||
else{
|
||||
$progressBarClass = 'progress-bar-success';
|
||||
$title = $langs->trans('TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress-$progressCalculated).'%');
|
||||
$diff = '<span class="text-success classfortooltip" title="'.dol_htmlentities($title.$diffTitle).'" ><i class="fa fa-caret-up"></i> '.($task->progress-$progressCalculated).'%</span>';
|
||||
}
|
||||
}
|
||||
|
||||
$out.= '<div class="progress-group">';
|
||||
|
||||
if($label !== false)
|
||||
{
|
||||
$out.= ' <span class="progress-text">';
|
||||
|
||||
if($label!==true){
|
||||
$out.= $label; // replace label by param
|
||||
}
|
||||
else{
|
||||
$out.= $task->getNomUrl(1).' '.dol_htmlentities($task->label);
|
||||
}
|
||||
$out.= ' </span>';
|
||||
}
|
||||
|
||||
|
||||
if($progressNumber !== false)
|
||||
{
|
||||
$out.= ' <span class="progress-number">';
|
||||
if($progressNumber!==true){
|
||||
$out.= $progressNumber; // replace label by param
|
||||
}
|
||||
else{
|
||||
if ($task->hasDelay()) $out.= img_warning($langs->trans("Late")).' ';
|
||||
|
||||
$out.= !empty($diff) ? $diff.' ':'';
|
||||
|
||||
$out.= '<b title="'.$langs->trans('TimeSpent').'" >';
|
||||
if ($task->duration_effective) $out.= convertSecondToTime($task->duration_effective, $timespentoutputformat);
|
||||
else $out.= '--:--';
|
||||
$out.= '</b>';
|
||||
|
||||
$out.= '/';
|
||||
|
||||
$out.= '<span title="'.$langs->trans('PlannedWorkload').'" >';
|
||||
if ($task->planned_workload) $out.= convertSecondToTime($task->planned_workload, $plannedworkloadoutputformat);
|
||||
else $out.= '--:--';
|
||||
}
|
||||
$out.= ' </span>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$out.= '</span>';
|
||||
$out.= ' <div class="progress sm '.$spaced.'" title="'.doubleval($task->progress).'%" >';
|
||||
$out.= ' <div class="progress-bar '.$progressBarClass.'" style="width: '.doubleval($task->progress).'%"></div>';
|
||||
$out.= ' </div>';
|
||||
$out.= '</div>';
|
||||
|
||||
|
||||
|
||||
return $out;
|
||||
}
|
||||
/**
|
||||
* @param task $task Task the task object
|
||||
* @param label $label string empty = auto (progress), string = replace output
|
||||
* @param tooltip $tooltip string empty = auto , string = replace output
|
||||
* @return string
|
||||
*/
|
||||
function getTaskProgressBadge($task, $label = '', $tooltip = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$out = '';
|
||||
$badgeClass = '';
|
||||
if ($task->progress != '')
|
||||
{
|
||||
// TODO : manage 100%
|
||||
|
||||
// define color according to time spend vs workload
|
||||
$badgeClass = 'badge ';
|
||||
if ($task->planned_workload){
|
||||
$progressCalculated = round(100 * doubleval($task->duration_effective) / doubleval($task->planned_workload), 2);
|
||||
|
||||
// this conf is actually hidden, by default we use 1% for "be carefull or warning"
|
||||
$warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.01;
|
||||
|
||||
if($progressCalculated > doubleval($task->progress)){
|
||||
$badgeClass.= 'badge-danger';
|
||||
}
|
||||
elseif($progressCalculated * $warningRatio >= doubleval($task->progress)){ // warning if close at 1%
|
||||
$badgeClass.= 'badge-warning';
|
||||
}
|
||||
else{
|
||||
$badgeClass.= 'badge-success';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$title = '';
|
||||
if(!empty($tooltip)){
|
||||
$badgeClass.= ' classfortooltip';
|
||||
$title = 'title="'.dol_htmlentities($tooltip).'"';
|
||||
}
|
||||
|
||||
if(empty($label)){
|
||||
$label = $task->progress.' %';
|
||||
}
|
||||
|
||||
if(!empty($label)){
|
||||
$out = '<span class="'.$badgeClass.'" '.$title.' >'.$label.'</span>';
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -61,7 +61,8 @@ function report_header($reportname, $notused, $period, $periodlink, $description
|
||||
{
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
|
||||
}
|
||||
print '<table width="100%" class="border">';
|
||||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
$variante = ($periodlink || $exportlink);
|
||||
|
||||
|
||||
@ -47,9 +47,10 @@ function dol_getwebuser($mode)
|
||||
* @param string $passwordtotest Password value to test
|
||||
* @param string $entitytotest Instance of data we must check
|
||||
* @param array $authmode Array list of selected authentication mode array('http', 'dolibarr', 'xxx'...)
|
||||
* @param string $context Context checkLoginPassEntity was created for ('api', 'dav', '')
|
||||
* @return string Login or ''
|
||||
*/
|
||||
function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode)
|
||||
function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode, $context = '')
|
||||
{
|
||||
global $conf,$langs;
|
||||
//global $dolauthmode; // To return authentication finally used
|
||||
@ -90,7 +91,7 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth
|
||||
{
|
||||
// Call function to check user/password
|
||||
$function='check_user_password_'.$mode;
|
||||
$login=call_user_func($function, $usertotest, $passwordtotest, $entitytotest);
|
||||
$login=call_user_func($function, $usertotest, $passwordtotest, $entitytotest, $context);
|
||||
if ($login) // Login is successfull
|
||||
{
|
||||
$test=false; // To stop once at first login success
|
||||
|
||||
@ -956,6 +956,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
|
||||
$colorBlindOptions = array(
|
||||
0 => $langs->trans('No'),
|
||||
'flashy' => $langs->trans('Flashy'),
|
||||
'protanopia' => $langs->trans('Protanopia'),
|
||||
'deuteranopes' => $langs->trans('Deuteranopes'),
|
||||
'tritanopes' => $langs->trans('Tritanopes'),
|
||||
|
||||
@ -22,83 +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.
|
||||
* @param string $contenttype Content type
|
||||
* @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')
|
||||
{
|
||||
$nbrep = 0;
|
||||
|
||||
dol_syslog('dolWebsiteReplacementOfLinks start (contenttype='.$contenttype." USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER')?'1':'')." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR')?'1':'').')', LOG_DEBUG);
|
||||
|
||||
// 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);
|
||||
|
||||
dol_syslog('dolWebsiteReplacementOfLinks end', LOG_DEBUG);
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove PHP code part from a string.
|
||||
*
|
||||
@ -124,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -147,34 +71,136 @@ 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;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -185,14 +211,14 @@ function dolKeepOnlyPhpCode($str)
|
||||
* @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, $contenttype='html', $containerid='')
|
||||
function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
|
||||
{
|
||||
global $db, $langs, $conf, $user;
|
||||
global $dolibarr_main_url_root, $dolibarr_main_data_root;
|
||||
|
||||
dol_syslog("dolWebsiteOutput start (contenttype=".$contenttype." containerid=".$containerid." 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));
|
||||
@ -213,35 +239,55 @@ function dolWebsiteOutput($content, $contenttype='html', $containerid='')
|
||||
{
|
||||
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
|
||||
{
|
||||
@ -254,7 +300,12 @@ function dolWebsiteOutput($content, $contenttype='html', $containerid='')
|
||||
$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);
|
||||
@ -265,20 +316,33 @@ function dolWebsiteOutput($content, $contenttype='html', $containerid='')
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -351,9 +415,11 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri
|
||||
|
||||
if (defined('USEDOLIBARREDITOR'))
|
||||
{
|
||||
print '<div class="margintoponly marginleftonly">';
|
||||
/*print '<div class="margintoponly marginleftonly">';
|
||||
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>';
|
||||
print '</div>';*/
|
||||
$text = "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.";
|
||||
setEventMessages($text, null, 'warnings', 'WEBSITEREDIRECTDISABLED'.$containerref);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ 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);
|
||||
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";
|
||||
@ -113,7 +113,7 @@ function dolSavePageContent($filetpl, $object, $objectpage)
|
||||
$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 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";
|
||||
@ -214,13 +214,7 @@ function dolSaveHtmlHeader($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;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -241,13 +235,7 @@ function dolSaveCssFile($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;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -268,13 +256,7 @@ function dolSaveJsFile($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;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -295,13 +277,7 @@ function dolSaveRobotFile($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;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -322,13 +298,7 @@ function dolSaveHtaccessFile($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;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -349,19 +319,33 @@ function dolSaveManifestJson($file, $content)
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
if (! $result)
|
||||
{
|
||||
setEventMessages('Failed to write file '.$file, null, 'errors');
|
||||
return false;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
return true;
|
||||
/**
|
||||
* 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
|
||||
* Show list of themes. Show all thumbs of themes/skins
|
||||
*
|
||||
* @param Website $website Object website to load the tempalte into
|
||||
* @return void
|
||||
@ -433,11 +417,25 @@ function showWebsiteTemplates(Website $website)
|
||||
|
||||
print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
|
||||
|
||||
$file=$dirtheme."/".$subdirwithoutzip.".jpg";
|
||||
$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';
|
||||
print '<img src="'.$url.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'" style="margin-bottom: 5px;">';
|
||||
|
||||
$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>';
|
||||
|
||||
@ -1330,7 +1330,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
if (! empty($conf->comptabilite->enabled))
|
||||
{
|
||||
// Files
|
||||
if (! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 1)
|
||||
if ((! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 1) || ! empty($conf->global->ACCOUNTANCY_SHOW_EXPORT_FILES_MENU))
|
||||
{
|
||||
$newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'files');
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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/');
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user