mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-12 02:42:33 +01:00
Merge branch 'develop' into patch-10
This commit is contained in:
@@ -8,6 +8,8 @@ $finder = (new PhpCsFixer\Finder())
|
||||
'custom',
|
||||
'documents',
|
||||
'doctemplates',
|
||||
'vendor',
|
||||
'install/doctemplates',
|
||||
'htdocs/custom',
|
||||
'htdocs/includes',
|
||||
'htdocs/install/doctemplates',
|
||||
@@ -41,6 +43,8 @@ return (new PhpCsFixer\Config())
|
||||
// So we use target PHP70 for the moment.
|
||||
'@PHP70Migration' => true,
|
||||
//'@PHP71Migration' => true,
|
||||
// Avoid adding public to const (incompatible with PHP 7.0):
|
||||
'visibility_required' => ['elements'=>['property', 'method']],
|
||||
|
||||
//'strict_param' => true,
|
||||
//'array_syntax' => ['syntax' => 'short'],
|
||||
|
||||
@@ -26,7 +26,7 @@ PHP libraries:
|
||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation. Used by dynamic price only. TODO Replace with dol_eval ?
|
||||
Escpos-php 3.0 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||
GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert
|
||||
MathPHP 2.8.1 MIT License Yes Modern math library for PHP
|
||||
MathPHP 2.8.1 MIT License Yes Modern math library for PHP (only few files)
|
||||
Mobiledetect 2.8.41 MIT License Yes Detect mobile devices browsers
|
||||
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
||||
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
|
||||
|
||||
17
SECURITY.md
17
SECURITY.md
@@ -82,18 +82,17 @@ Scope is the web application (backoffice) and the APIs.
|
||||
## Examples of vulnerabilities that are Non-qualified for reporting.
|
||||
|
||||
* "Self" XSS
|
||||
* SSL/TLS best practices
|
||||
* Denial of Service attacks
|
||||
* Clickjacking/UI redressing
|
||||
* Physical or social engineering attempts or issues that require physical access to a victim’s computer/device
|
||||
* Presence of autocomplete attribute on web forms
|
||||
* Vulnerabilities affecting outdated browsers or platforms, or vulnerabilities inside browsers themself.
|
||||
* Logout and other instances of low-severity Cross-Site Request Forgery
|
||||
* Missing security-related HTTP headers which do not lead directly to a vulnerability
|
||||
* Reports from automated web vulnerability scanners (Acunetix, Vega, etc.) that have not been validated
|
||||
* Invalid or missing SPF (Sender Policy Framework) records (Incomplete or missing SPF/DKIM/DMARC)
|
||||
* Reports on features flagged as "experimental" or "development"
|
||||
* Software version or private IP disclosure when logged-in user is admin
|
||||
* Reports on features on modules flagged as "deprecated", "experimental" or "development" if the module needs to be enabled for that (this is not the case on production).
|
||||
* Software or libraries versions or private IP disclosure when logged-in user is admin
|
||||
* Stack traces or path disclosure when logged-in user is admin
|
||||
* Any vulnerabilities due to a configuration different than the one defined in chapter "Scope for qualified vulnerabilities".
|
||||
* Brute force attacks on login page, password forgotten page or any public pages (/public/*) are not qualified if the fail2ban recommended fail2ban rules were not installed.
|
||||
* Vulnerabilities affecting outdated browsers or platforms, or vulnerabilities inside browsers themself.
|
||||
* Brute force attacks on login page, password forgotten page or any public pages (/public/*) are not qualified if the recommended fail2ban rules were not installed.
|
||||
* SSL/TLS best practices
|
||||
* Denial of Service attacks
|
||||
* Invalid or missing SPF (Sender Policy Framework) records (Incomplete or missing SPF/DKIM/DMARC)
|
||||
* Physical or social engineering attempts or issues that require physical access to a victim’s computer/device
|
||||
|
||||
124
dev/examples/stripe/webhook_ipn_paymentintent_failed_sepa.txt
Normal file
124
dev/examples/stripe/webhook_ipn_paymentintent_failed_sepa.txt
Normal file
@@ -0,0 +1,124 @@
|
||||
{
|
||||
"id": "evt_123456789",
|
||||
"object": "event",
|
||||
"api_version": "2023-10-16",
|
||||
"created": 1702053463,
|
||||
"data": {
|
||||
"object": {
|
||||
"id": "pi_123456789",
|
||||
"object": "payment_intent",
|
||||
"amount": 60,
|
||||
"amount_capturable": 0,
|
||||
"amount_details": {
|
||||
"tip": {
|
||||
}
|
||||
},
|
||||
"amount_received": 0,
|
||||
"application": null,
|
||||
"application_fee_amount": null,
|
||||
"automatic_payment_methods": null,
|
||||
"canceled_at": null,
|
||||
"cancellation_reason": null,
|
||||
"capture_method": "automatic",
|
||||
"client_secret": "pi_123456789_secret_123456789",
|
||||
"confirmation_method": "automatic",
|
||||
"created": 1702053448,
|
||||
"currency": "eur",
|
||||
"customer": "cus_123456789",
|
||||
"description": "Stripe payment from makeStripeSepaRequest: DID=31262-INV=123-CUS=123 did=123 ref=FA2312-123",
|
||||
"invoice": null,
|
||||
"last_payment_error": {
|
||||
"code": "",
|
||||
"decline_code": "generic_decline",
|
||||
"message": "The transaction can't be processed because your customer's account information is missing or incorrect. Collect a new mandate and ask your customer to provide their name and address exactly as it appears on their bank account. After this, you can attempt the transaction again.",
|
||||
"payment_method": {
|
||||
"id": "pm_123456789",
|
||||
"object": "payment_method",
|
||||
"billing_details": {
|
||||
"address": {
|
||||
"city": null,
|
||||
"country": "FR",
|
||||
"line1": null,
|
||||
"line2": null,
|
||||
"postal_code": null,
|
||||
"state": null
|
||||
},
|
||||
"email": "email@example.com",
|
||||
"name": "Test example",
|
||||
"phone": null
|
||||
},
|
||||
"created": 1692688898,
|
||||
"customer": "cus_123456789",
|
||||
"livemode": false,
|
||||
"metadata": {
|
||||
"dol_version": "19.0.0-dev",
|
||||
"dol_thirdparty_id": "123",
|
||||
"ipaddress": "1.2.3.4",
|
||||
"dol_id": "123",
|
||||
"dol_type": "companypaymentmode",
|
||||
"dol_entity": "1"
|
||||
},
|
||||
"sepa_debit": {
|
||||
"bank_code": "123",
|
||||
"branch_code": "",
|
||||
"country": "AT",
|
||||
"fingerprint": "123456789",
|
||||
"generated_from": {
|
||||
"charge": null,
|
||||
"setup_attempt": null
|
||||
},
|
||||
"last4": "3202"
|
||||
},
|
||||
"type": "sepa_debit"
|
||||
},
|
||||
"type": "card_error"
|
||||
},
|
||||
"latest_charge": "py_123456789",
|
||||
"livemode": false,
|
||||
"metadata": {
|
||||
"dol_version": "19.0.0-beta",
|
||||
"dol_thirdparty_id": "123",
|
||||
"ipaddress": "1.2.3.4",
|
||||
"dol_id": "123",
|
||||
"dol_type": "facture",
|
||||
"dol_entity": "1"
|
||||
},
|
||||
"next_action": null,
|
||||
"on_behalf_of": null,
|
||||
"payment_method": null,
|
||||
"payment_method_configuration_details": null,
|
||||
"payment_method_options": {
|
||||
"card": {
|
||||
"installments": null,
|
||||
"mandate_options": null,
|
||||
"network": null,
|
||||
"request_three_d_secure": "automatic"
|
||||
},
|
||||
"sepa_debit": {
|
||||
}
|
||||
},
|
||||
"payment_method_types": [
|
||||
"card",
|
||||
"sepa_debit"
|
||||
],
|
||||
"processing": null,
|
||||
"receipt_email": null,
|
||||
"review": null,
|
||||
"setup_future_usage": null,
|
||||
"shipping": null,
|
||||
"source": null,
|
||||
"statement_descriptor": "DID=123-",
|
||||
"statement_descriptor_suffix": "DID=123-",
|
||||
"status": "requires_payment_method",
|
||||
"transfer_data": null,
|
||||
"transfer_group": null
|
||||
}
|
||||
},
|
||||
"livemode": false,
|
||||
"pending_webhooks": 1,
|
||||
"request": {
|
||||
"id": null,
|
||||
"idempotency_key": null
|
||||
},
|
||||
"type": "payment_intent.payment_failed"
|
||||
}
|
||||
@@ -38,6 +38,8 @@ error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
define('PRODUCT', "apstats");
|
||||
define('VERSION', "1.0");
|
||||
|
||||
$phpstanlevel = 2;
|
||||
|
||||
|
||||
print '***** '.constant('PRODUCT').' - '.constant('VERSION').' *****'."\n";
|
||||
if (empty($argv[1])) {
|
||||
@@ -71,6 +73,7 @@ while ($i < $argc) {
|
||||
$i++;
|
||||
}
|
||||
|
||||
$timestart = time();
|
||||
|
||||
// Count lines of code of Dolibarr itself
|
||||
/*
|
||||
@@ -102,7 +105,7 @@ exec($commandcheck, $output_arrdep, $resexecdep);
|
||||
|
||||
|
||||
// Get technical debt
|
||||
$commandcheck = ($dirphpstan ? $dirphpstan.'/' : '').'phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 5G --error-format=github';
|
||||
$commandcheck = ($dirphpstan ? $dirphpstan.'/' : '').'phpstan --level='.$phpstanlevel.' -v analyze -a build/phpstan/bootstrap.php --memory-limit 5G --error-format=github';
|
||||
print 'Execute PHPStan to get the technical debt: '.$commandcheck."\n";
|
||||
$output_arrtd = array();
|
||||
$resexectd = 0;
|
||||
@@ -169,6 +172,8 @@ foreach (array('proj', 'dep') as $source) {
|
||||
}
|
||||
}
|
||||
|
||||
$timeend = time();
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@@ -224,7 +229,7 @@ th,td {
|
||||
.nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.opacity {
|
||||
.opacitymedium {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.centpercent {
|
||||
@@ -293,7 +298,7 @@ $html .= '<body>'."\n";
|
||||
$html .= '<header>'."\n";
|
||||
$html .= '<h1>Advanced Project Statistics</h1>'."\n";
|
||||
$currentDate = date("Y-m-d H:i:s"); // Format: Year-Month-Day Hour:Minute:Second
|
||||
$html .= '<span class="opacity">Generated on '.$currentDate.'</span>'."\n";
|
||||
$html .= '<span class="opacitymedium">Generated on '.$currentDate.' in '.($timeend - $timestart).' seconds</span>'."\n";
|
||||
$html .= '</header>'."\n";
|
||||
|
||||
$html .= '<section class="chapter" id="linesofcode">'."\n";
|
||||
@@ -372,19 +377,24 @@ $html .= '<b>'.formatNumber($arraycocomo['proj']['people'] * $arraycocomo['proj'
|
||||
$html .= ' monthes people</b><br>';
|
||||
$html .= '</section>'."\n";
|
||||
|
||||
$html .= '<section class="chapter" id="technicaldebt">'."\n";
|
||||
$html .= '<h2>Technical debt ('.count($output_arrtd).')</h2><br>'."\n";
|
||||
$html .= '<div class="div-table-responsive">'."\n";
|
||||
$html .= '<table class="list_technical_debt">'."\n";
|
||||
$html .= '<tr><td>File</td><td>Line</td><td>Type</td></tr>'."\n";
|
||||
$tmp = '';
|
||||
$nblines = 0;
|
||||
foreach ($output_arrtd as $line) {
|
||||
$reg = array();
|
||||
//print $line."\n";
|
||||
preg_match('/^::error file=(.*),line=(\d+),col=(\d+)::(.*)$/', $line, $reg);
|
||||
if (!empty($reg[1])) {
|
||||
$html .= '<tr><td>'.$reg[1].'</td><td>'.$reg[2].'</td><td>'.$reg[4].'</td></tr>'."\n";
|
||||
$tmp .= '<tr><td>'.$reg[1].'</td><td>'.$reg[2].'</td><td>'.$reg[4].'</td></tr>'."\n";
|
||||
$nblines++;
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '<section class="chapter" id="technicaldebt">'."\n";
|
||||
$html .= '<h2>Technical debt <span class="opacitymedium">(PHPStan level '.$phpstanlevel.' => '.$nblines.' warnings)</span></h2><br>'."\n";
|
||||
$html .= '<div class="div-table-responsive">'."\n";
|
||||
$html .= '<table class="list_technical_debt">'."\n";
|
||||
$html .= '<tr><td>File</td><td>Line</td><td>Type</td></tr>'."\n";
|
||||
$html .= $tmp;
|
||||
$html .= '</table>';
|
||||
$html .= '</div>';
|
||||
$html .= '</section>'."\n";
|
||||
|
||||
@@ -36,7 +36,7 @@ MINPHPVERSION="7.0"
|
||||
echo "***** run-php-cs-fixer.sh *****"
|
||||
|
||||
if [ "x$1" = "x" ]; then
|
||||
echo "Syntax: run-php-cs-fixer.sh check|fix [path]"
|
||||
echo "Syntax: run-php-cs-fixer.sh check|fix [path_from_root_project]"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
|
||||
@@ -21,10 +21,12 @@ use Rector\Php71\ValueObject\TwoNodeMatch;
|
||||
use Symplify\RuleDocGenerator\Exception\PoorDocumentationException;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
use PhpParser\Node\Expr\BinaryOp\NotEqual;
|
||||
use PhpParser\Node\Expr\BinaryOp\Greater;
|
||||
use PhpParser\Node\Expr\BinaryOp\GreaterOrEqual;
|
||||
use PhpParser\Node\Expr\BinaryOp\Smaller;
|
||||
use PhpParser\Node\Expr\BinaryOp\SmallerOrEqual;
|
||||
use PhpParser\Node\Expr\BinaryOp\NotIdentical;
|
||||
|
||||
/**
|
||||
* Class with Rector custom rule to fix code
|
||||
@@ -55,7 +57,7 @@ class GlobalToFunction extends AbstractRector
|
||||
public function getRuleDefinition(): RuleDefinition
|
||||
{
|
||||
return new RuleDefinition(
|
||||
'Change $conf->global to getDolGlobal',
|
||||
'Change $conf->global to getDolGlobal in context (1) conf->global Operator Value or (2) function(conf->global...)',
|
||||
[new CodeSample(
|
||||
'$conf->global->CONSTANT',
|
||||
'getDolGlobalInt(\'CONSTANT\')'
|
||||
@@ -70,14 +72,15 @@ class GlobalToFunction extends AbstractRector
|
||||
*/
|
||||
public function getNodeTypes(): array
|
||||
{
|
||||
return [Equal::class, Greater::class, GreaterOrEqual::class, Smaller::class, SmallerOrEqual::class, BooleanAnd::class, Concat::class, ArrayDimFetch::class];
|
||||
return [FuncCall::class, Equal::class, NotEqual::class, Greater::class, GreaterOrEqual::class, Smaller::class, SmallerOrEqual::class, NotIdentical::class, BooleanAnd::class, Concat::class, ArrayDimFetch::class];
|
||||
}
|
||||
|
||||
/**
|
||||
* refactor
|
||||
*
|
||||
* @param Node $node A node
|
||||
* @return Equal|Concat|ArrayDimFetch|void
|
||||
* @return FuncCall|Equal|Concat|ArrayDimFetch|void
|
||||
* return $node unchanged or void to do nothing
|
||||
*/
|
||||
public function refactor(Node $node)
|
||||
{
|
||||
@@ -97,6 +100,35 @@ class GlobalToFunction extends AbstractRector
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
|
||||
if ($node instanceof FuncCall) {
|
||||
$tmpfunctionname = $this->getName($node);
|
||||
if (in_array($tmpfunctionname, array('dol_escape_htmltag', 'make_substitutions', 'min', 'max', 'explode'))) {
|
||||
$args = $node->getArgs();
|
||||
$nbofparam = count($args);
|
||||
|
||||
if ($nbofparam >= 1) {
|
||||
$tmpargs = $args;
|
||||
foreach ($args as $key => $arg) { // only 1 element in this array
|
||||
//var_dump($key);
|
||||
//var_dump($arg->value);exit;
|
||||
if ($this->isGlobalVar($arg->value)) {
|
||||
$constName = $this->getConstName($arg->value);
|
||||
if (empty($constName)) {
|
||||
return;
|
||||
}
|
||||
$a = new FuncCall(new Name('getDolGlobalString'), [new Arg($constName)]);
|
||||
$tmpargs[$key] = new Arg($a);
|
||||
|
||||
$r = new FuncCall(new Name($tmpfunctionname), $tmpargs);
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
|
||||
if ($node instanceof Concat) {
|
||||
if ($this->isGlobalVar($node->left)) {
|
||||
$constName = $this->getConstName($node->left);
|
||||
@@ -125,6 +157,7 @@ class GlobalToFunction extends AbstractRector
|
||||
}
|
||||
return new Concat($leftConcat, $rightConcat);
|
||||
}
|
||||
|
||||
if ($node instanceof BooleanAnd) {
|
||||
$nodes = $this->resolveTwoNodeMatch($node);
|
||||
if (!isset($nodes)) {
|
||||
@@ -135,10 +168,16 @@ class GlobalToFunction extends AbstractRector
|
||||
$node = $nodes->getFirstExpr();
|
||||
}
|
||||
|
||||
// Now process all comparison like:
|
||||
// $conf->global->... Operator Value
|
||||
|
||||
$typeofcomparison = '';
|
||||
if ($node instanceof Equal) {
|
||||
$typeofcomparison = 'Equal';
|
||||
}
|
||||
if ($node instanceof NotEqual) {
|
||||
$typeofcomparison = 'NotEqual';
|
||||
}
|
||||
if ($node instanceof Greater) {
|
||||
$typeofcomparison = 'Greater';
|
||||
}
|
||||
@@ -151,6 +190,10 @@ class GlobalToFunction extends AbstractRector
|
||||
if ($node instanceof SmallerOrEqual) {
|
||||
$typeofcomparison = 'SmallerOrEqual';
|
||||
}
|
||||
if ($node instanceof NotIdentical) {
|
||||
$typeofcomparison = 'NotIdentical';
|
||||
//var_dump($node->left);
|
||||
}
|
||||
if (empty($typeofcomparison)) {
|
||||
return;
|
||||
}
|
||||
@@ -160,7 +203,8 @@ class GlobalToFunction extends AbstractRector
|
||||
}
|
||||
|
||||
// Test the type after the comparison conf->global->xxx to know the name of function
|
||||
switch ($node->right->getType()) {
|
||||
$typeright = $node->right->getType();
|
||||
switch ($typeright) {
|
||||
case 'Scalar_LNumber':
|
||||
$funcName = 'getDolGlobalInt';
|
||||
break;
|
||||
@@ -185,6 +229,15 @@ class GlobalToFunction extends AbstractRector
|
||||
$node->right
|
||||
);
|
||||
}
|
||||
if ($typeofcomparison == 'NotEqual') {
|
||||
return new NotEqual(
|
||||
new FuncCall(
|
||||
new Name($funcName),
|
||||
[new Arg($constName)]
|
||||
),
|
||||
$node->right
|
||||
);
|
||||
}
|
||||
if ($typeofcomparison == 'Greater') {
|
||||
return new Greater(
|
||||
new FuncCall(
|
||||
@@ -221,6 +274,15 @@ class GlobalToFunction extends AbstractRector
|
||||
$node->right
|
||||
);
|
||||
}
|
||||
if ($typeofcomparison == 'NotIdentical') {
|
||||
return new NotIdentical(
|
||||
new FuncCall(
|
||||
new Name($funcName),
|
||||
[new Arg($constName)]
|
||||
),
|
||||
$node->right
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -233,7 +295,7 @@ class GlobalToFunction extends AbstractRector
|
||||
{
|
||||
return $this->binaryOpManipulator->matchFirstAndSecondConditionNode(
|
||||
$booleanAnd,
|
||||
// $conf->global == $value
|
||||
// Function to check if we are in the case $conf->global->... == $value
|
||||
function (Node $node): bool {
|
||||
if (!$node instanceof Equal) {
|
||||
return \false;
|
||||
@@ -257,7 +319,7 @@ class GlobalToFunction extends AbstractRector
|
||||
* Check if node is a global access with format conf->global->XXX
|
||||
*
|
||||
* @param Node $node A node
|
||||
* @return bool Return true if noe is conf->global->XXX
|
||||
* @return bool Return true if node is conf->global->XXX
|
||||
*/
|
||||
private function isGlobalVar($node)
|
||||
{
|
||||
|
||||
@@ -145,14 +145,14 @@ print '</td></tr>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="fieldrequired">'.$langs->trans("ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT").'</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" size="100" id="ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT" name="ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT" value="' . dol_escape_htmltag($conf->global->ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT). '">';
|
||||
print '<input type="text" size="100" id="ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT" name="ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT" value="' . dol_escape_htmltag(getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT')). '">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accounting groups used for the income statement
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="fieldrequired">'.$langs->trans("ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT").'</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" size="100" id="ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT" name="ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT" value="' . dol_escape_htmltag($conf->global->ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT). '">';
|
||||
print '<input type="text" size="100" id="ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT" name="ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT" value="' . dol_escape_htmltag(getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT')). '">';
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
@@ -100,7 +100,7 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction')) {
|
||||
$search_date_start = strtotime($fiscalYear->date_start);
|
||||
$search_date_end = strtotime($fiscalYear->date_end);
|
||||
} else {
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
if (dol_print_date(dol_now(), '%m') < $month_start) {
|
||||
$year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||
|
||||
@@ -170,7 +170,7 @@ if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GE
|
||||
$search_date_start = strtotime($fiscalYear->date_start);
|
||||
$search_date_end = strtotime($fiscalYear->date_end);
|
||||
} else {
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
if (dol_print_date(dol_now(), '%m') < $month_start) {
|
||||
$year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||
|
||||
@@ -165,7 +165,7 @@ if (!in_array($action, array('delmouv', 'delmouvconfirm')) && !GETPOSTISSET('beg
|
||||
$search_date_start = strtotime($fiscalYear->date_start);
|
||||
$search_date_end = strtotime($fiscalYear->date_end);
|
||||
} else {
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
if (dol_print_date(dol_now(), '%m') < $month_start) {
|
||||
$year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||
|
||||
@@ -141,7 +141,7 @@ if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('searc
|
||||
$search_date_start = strtotime($fiscalYear->date_start);
|
||||
$search_date_end = strtotime($fiscalYear->date_end);
|
||||
} else {
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
if (dol_print_date(dol_now(), '%m') < $month_start) {
|
||||
$year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||
|
||||
@@ -367,7 +367,7 @@ class BookKeeping extends CommonObject
|
||||
$this->piece_num = $objnum->piece_num;
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this).":: create this->piece_num=".$this->piece_num, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::create this->piece_num=".$this->piece_num, LOG_DEBUG);
|
||||
if (empty($this->piece_num)) {
|
||||
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
|
||||
$sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
|
||||
@@ -87,8 +87,8 @@ if (is_array($fiscal_periods)) {
|
||||
}
|
||||
}
|
||||
|
||||
$accounting_groups_used_for_balance_sheet_account = array_filter(array_map('trim', explode(',', $conf->global->ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT)), 'strlen');
|
||||
$accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', $conf->global->ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT)), 'strlen');
|
||||
$accounting_groups_used_for_balance_sheet_account = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT'))), 'strlen');
|
||||
$accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen');
|
||||
|
||||
|
||||
/*
|
||||
@@ -263,6 +263,7 @@ if (isset($current_fiscal_period)) {
|
||||
'label' => $langs->trans('DateEnd'),
|
||||
'value' => $current_fiscal_period['date_end']
|
||||
);
|
||||
|
||||
$formconfirm = $form->formconfirm(
|
||||
$_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'],
|
||||
$langs->trans('AccountancyClosureAccountingReversal'),
|
||||
|
||||
@@ -53,7 +53,7 @@ if (!$user->hasRight('accounting', 'bind', 'write')) {
|
||||
|
||||
$accountingAccount = new AccountingAccount($db);
|
||||
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
if (GETPOST("year", 'int')) {
|
||||
$year_start = GETPOST("year", 'int');
|
||||
} else {
|
||||
|
||||
@@ -36,7 +36,7 @@ $langs->loadLangs(array("compta", "bills", "other", "accountancy"));
|
||||
$validatemonth = GETPOST('validatemonth', 'int');
|
||||
$validateyear = GETPOST('validateyear', 'int');
|
||||
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
if (GETPOST("year", 'int')) {
|
||||
$year_start = GETPOST("year", 'int');
|
||||
} else {
|
||||
|
||||
@@ -104,10 +104,16 @@ $error = 0;
|
||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||
|
||||
if (empty($date_startmonth) || empty($date_endmonth)) {
|
||||
if (empty($date_startmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_start = $dates['date_start'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
}
|
||||
if (empty($date_endmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_end = $dates['date_end'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
@@ -306,16 +312,28 @@ if ($result) {
|
||||
|
||||
// get_url may return -1 which is not traversable
|
||||
if (is_array($links) && count($links) > 0) {
|
||||
// Test if entry is for a social contribution, salary or expense report.
|
||||
// In such a case, we will ignore the bank url line for user
|
||||
$is_sc = false;
|
||||
$is_salary = false;
|
||||
$is_expensereport = false;
|
||||
foreach ($links as $v) {
|
||||
if ($v['type'] == 'sc') {
|
||||
$is_sc = true;
|
||||
break;
|
||||
}
|
||||
if ($v['type'] == 'payment_salary') {
|
||||
$is_salary = true;
|
||||
break;
|
||||
}
|
||||
if ($v['type'] == 'payment_expensereport') {
|
||||
$is_expensereport = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Now loop on each link of record in bank (code similar to bankentries_list.php)
|
||||
foreach ($links as $key => $val) {
|
||||
if ($links[$key]['type'] == 'user' && !$is_sc) {
|
||||
if ($links[$key]['type'] == 'user' && !$is_sc && !$is_salary && !$is_expensereport) {
|
||||
continue;
|
||||
}
|
||||
if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various'))) {
|
||||
@@ -365,6 +383,7 @@ if ($result) {
|
||||
$userstatic->firstname = $tabuser[$obj->rowid]['firstname'];
|
||||
$userstatic->lastname = $tabuser[$obj->rowid]['lastname'];
|
||||
$userstatic->statut = $tabuser[$obj->rowid]['status'];
|
||||
$userstatic->status = $tabuser[$obj->rowid]['status'];
|
||||
$userstatic->accountancy_code = $tabuser[$obj->rowid]['accountancy_code'];
|
||||
if ($userstatic->id > 0) {
|
||||
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, 'accountancy', 0);
|
||||
|
||||
@@ -90,10 +90,16 @@ $journal_label = $accountingjournalstatic->label;
|
||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||
|
||||
if (empty($date_startmonth) || empty($date_endmonth)) {
|
||||
if (empty($date_startmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_start = $dates['date_start'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
}
|
||||
if (empty($date_endmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_end = $dates['date_end'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
|
||||
@@ -92,10 +92,16 @@ $journal_label = $accountingjournalstatic->label;
|
||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||
|
||||
if (empty($date_startmonth) || empty($date_endmonth)) {
|
||||
if (empty($date_startmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_start = $dates['date_start'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
}
|
||||
if (empty($date_endmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_end = $dates['date_end'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
|
||||
@@ -94,10 +94,16 @@ $journal_label = $accountingjournalstatic->label;
|
||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||
|
||||
if (empty($date_startmonth) || empty($date_endmonth)) {
|
||||
if (empty($date_startmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_start = $dates['date_start'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
}
|
||||
if (empty($date_endmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_end = $dates['date_end'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
@@ -464,7 +470,7 @@ if ($action == 'writebookkeeping' && !$error) {
|
||||
|
||||
// Warranty
|
||||
if (!$errorforline) {
|
||||
if (is_iterable($tabwarranty[$key])) {
|
||||
if (is_array($tabwarranty[$key])) {
|
||||
foreach ($tabwarranty[$key] as $k => $mt) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
@@ -706,7 +712,7 @@ if ($action == 'writebookkeeping' && !$error) {
|
||||
|
||||
// Revenue stamp
|
||||
if (!$errorforline) {
|
||||
if (is_iterable($tabrevenuestamp[$key])) {
|
||||
if (is_array($tabrevenuestamp[$key])) {
|
||||
foreach ($tabrevenuestamp[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
$accountingaccount->fetch(null, $k, true); // TODO Use a cache for label
|
||||
@@ -1144,7 +1150,7 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
|
||||
// Warranty
|
||||
if (is_iterable($tabwarranty[$key])) {
|
||||
if (is_array($tabwarranty[$key])) {
|
||||
foreach ($tabwarranty[$key] as $k => $mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<!-- Thirdparty warranty -->";
|
||||
@@ -1292,7 +1298,7 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
|
||||
// Revenue stamp
|
||||
if (is_iterable($tabrevenuestamp[$key])) {
|
||||
if (is_array($tabrevenuestamp[$key])) {
|
||||
foreach ($tabrevenuestamp[$key] as $k => $mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<!-- Thirdparty revenuestamp -->";
|
||||
|
||||
@@ -61,10 +61,16 @@ $parameters = array();
|
||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||
|
||||
if (empty($date_startmonth) || empty($date_endmonth)) {
|
||||
if (empty($date_startmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_start = $dates['date_start'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
}
|
||||
if (empty($date_endmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_end = $dates['date_end'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
|
||||
@@ -51,7 +51,7 @@ if (!$user->hasRight('accounting', 'bind', 'write')) {
|
||||
|
||||
$accountingAccount = new AccountingAccount($db);
|
||||
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
if (GETPOST("year", 'int')) {
|
||||
$year_start = GETPOST("year", 'int');
|
||||
} else {
|
||||
|
||||
@@ -53,7 +53,7 @@ if (($accountancyexport->getFormatCode($formatexportset) == 'fec' || $accountanc
|
||||
}
|
||||
$datetouseforfilename = $search_date_end;
|
||||
$tmparray = dol_getdate($datetouseforfilename);
|
||||
$fiscalmonth = !getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START;
|
||||
$fiscalmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
// Define end of month to use
|
||||
if ($tmparray['mon'] < $fiscalmonth || $fiscalmonth == 1) {
|
||||
$tmparray['mon'] = $fiscalmonth == 1 ? 12 : $fiscalmonth - 1;
|
||||
|
||||
@@ -353,12 +353,12 @@ print "</td></tr>\n";
|
||||
print '<tr class="oddeven drag" id="startfirstdayof"><td>';
|
||||
print $langs->trans("MemberSubscriptionStartAfter");
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="right width50" id="MEMBER_SUBSCRIPTION_START_AFTER" name="MEMBER_SUBSCRIPTION_START_AFTER" value="'.(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER') ? getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER') : '').'">';
|
||||
print '<input type="text" class="right width50" id="MEMBER_SUBSCRIPTION_START_AFTER" name="MEMBER_SUBSCRIPTION_START_AFTER" value="'.getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Mail required for members
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("AdherentMailRequired").'</td><td>';
|
||||
print $form->selectyesno('ADHERENT_MAIL_REQUIRED', (getDolGlobalString('ADHERENT_MAIL_REQUIRED') ? $conf->global->ADHERENT_MAIL_REQUIRED : 0), 1);
|
||||
print $form->selectyesno('ADHERENT_MAIL_REQUIRED', getDolGlobalInt('ADHERENT_MAIL_REQUIRED'), 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Login/Pass required for members
|
||||
@@ -370,24 +370,24 @@ print "</td></tr>\n";
|
||||
|
||||
// Send mail information is on by default
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MemberSendInformationByMailByDefault").'</td><td>';
|
||||
print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', (getDolGlobalString('ADHERENT_DEFAULT_SENDINFOBYMAIL') ? $conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL : 0), 1);
|
||||
print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', getDolGlobalInt('ADHERENT_DEFAULT_SENDINFOBYMAIL', 0), 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Create an external user login for each new member subscription validated
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MemberCreateAnExternalUserForSubscriptionValidated").'</td><td>';
|
||||
print $form->selectyesno('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', (getDolGlobalString('ADHERENT_CREATE_EXTERNAL_USER_LOGIN') ? $conf->global->ADHERENT_CREATE_EXTERNAL_USER_LOGIN : 0), 1);
|
||||
print $form->selectyesno('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', getDolGlobalInt('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', 0), 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Create an external user login for each new member subscription validated
|
||||
$linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.$conf->entity : '');
|
||||
$linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.((int) $conf->entity) : '');
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist).'</td><td>';
|
||||
print $form->selectyesno('MEMBER_PUBLIC_ENABLED', (getDolGlobalString('MEMBER_PUBLIC_ENABLED') ? $conf->global->MEMBER_PUBLIC_ENABLED : 0), 1);
|
||||
print $form->selectyesno('MEMBER_PUBLIC_ENABLED', getDolGlobalInt('MEMBER_PUBLIC_ENABLED', 0), 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Allow members to change type on renewal forms
|
||||
/* To test during next beta
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MemberAllowchangeOfType").'</td><td>';
|
||||
print $form->selectyesno('MEMBER_ALLOW_CHANGE_OF_TYPE', (!empty($conf->global->MEMBER_ALLOW_CHANGE_OF_TYPE) ? 0 : 1), 1);
|
||||
print $form->selectyesno('MEMBER_ALLOW_CHANGE_OF_TYPE', (getDolGlobalInt('MEMBER_ALLOW_CHANGE_OF_TYPE') ? 0 : 1), 1);
|
||||
print "</td></tr>\n";
|
||||
*/
|
||||
|
||||
@@ -416,7 +416,7 @@ if (isModEnabled('facture')) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("VATToUseForSubscriptions").'</td>';
|
||||
if (isModEnabled("banque")) {
|
||||
print '<td>';
|
||||
print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0'=>$langs->trans("NoVatOnSubscription"), 'defaultforfoundationcountry'=>$langs->trans("Default")), (!getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS') ? '0' : $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0);
|
||||
print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0'=>$langs->trans("NoVatOnSubscription"), 'defaultforfoundationcountry'=>$langs->trans("Default")), getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS', '0'), 0);
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="right">';
|
||||
@@ -428,7 +428,7 @@ if (isModEnabled('facture')) {
|
||||
if (isModEnabled("product") || isModEnabled("service")) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>';
|
||||
print '<td>';
|
||||
$selected = (!getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') ? '' : $conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
|
||||
$selected = getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS');
|
||||
print img_picto('', 'product', 'class="pictofixedwidth"');
|
||||
$form->select_produits($selected, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', '', 0);
|
||||
print '</td>';
|
||||
|
||||
@@ -215,7 +215,7 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) {
|
||||
print '</td><td>';
|
||||
$listofval = array();
|
||||
$listofval += $adht->liste_array(1);
|
||||
$forcetype = !getDolGlobalString('MEMBER_NEWFORM_FORCETYPE') ? -1 : $conf->global->MEMBER_NEWFORM_FORCETYPE;
|
||||
$forcetype = getDolGlobalInt('MEMBER_NEWFORM_FORCETYPE', -1);
|
||||
print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval) > 1 ? 1 : 0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
@@ -225,7 +225,7 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) {
|
||||
print '<tr class="oddeven drag" id="trforcenature"><td>';
|
||||
print $langs->trans("ForceMemberNature");
|
||||
print '</td><td>';
|
||||
$forcenature = !getDolGlobalString('MEMBER_NEWFORM_FORCEMORPHY') ? 0 : $conf->global->MEMBER_NEWFORM_FORCEMORPHY;
|
||||
$forcenature = getDolGlobalInt('MEMBER_NEWFORM_FORCEMORPHY', 0);
|
||||
print $form->selectarray("MEMBER_NEWFORM_FORCEMORPHY", $morphys, $forcenature, 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
@@ -233,25 +233,25 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) {
|
||||
print '<tr class="oddeven" id="tramount"><td>';
|
||||
print $langs->trans("DefaultAmount");
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="right width50" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" value="'.(getDolGlobalString('MEMBER_NEWFORM_AMOUNT') ? $conf->global->MEMBER_NEWFORM_AMOUNT : '').'">';
|
||||
print '<input type="text" class="right width50" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" value="'.getDolGlobalString('MEMBER_NEWFORM_AMOUNT').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Min amount
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("MinimumAmount");
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="right width50" id="MEMBER_MIN_AMOUNT" name="MEMBER_MIN_AMOUNT" value="'.(getDolGlobalString('MEMBER_MIN_AMOUNT') ? $conf->global->MEMBER_MIN_AMOUNT : '').'">';
|
||||
print '<input type="text" class="right width50" id="MEMBER_MIN_AMOUNT" name="MEMBER_MIN_AMOUNT" value="'.getDolGlobalString('MEMBER_MIN_AMOUNT').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// SHow counter of validated members publicly
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("MemberCountersArePublic");
|
||||
print '</td><td>';
|
||||
print $form->selectyesno("MEMBER_COUNTERS_ARE_PUBLIC", (getDolGlobalString('MEMBER_COUNTERS_ARE_PUBLIC') ? $conf->global->MEMBER_COUNTERS_ARE_PUBLIC : 0), 1);
|
||||
print $form->selectyesno("MEMBER_COUNTERS_ARE_PUBLIC", getDolGlobalInt('MEMBER_COUNTERS_ARE_PUBLIC'), 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Show the table of all available membership types. If not, show a form (as the default was for Dolibarr <=16.0)
|
||||
$skiptable = (getDolGlobalString('MEMBER_SKIP_TABLE') ? $conf->global->MEMBER_SKIP_TABLE : 0);
|
||||
$skiptable = getDolGlobalInt('MEMBER_SKIP_TABLE');
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("MembersShowMembershipTypesTable");
|
||||
print '</td><td>';
|
||||
@@ -259,7 +259,7 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) {
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Show "vote allowed" setting for membership types
|
||||
$hidevoteallowed = (getDolGlobalString('MEMBER_HIDE_VOTE_ALLOWED') ? $conf->global->MEMBER_HIDE_VOTE_ALLOWED : 0);
|
||||
$hidevoteallowed = getDolGlobalInt('MEMBER_HIDE_VOTE_ALLOWED');
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("MembersShowVotesAllowed");
|
||||
print '</td><td>';
|
||||
@@ -282,7 +282,7 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) {
|
||||
if (isModEnabled('stripe')) {
|
||||
$listofval['stripe'] = 'Stripe';
|
||||
}
|
||||
print $form->selectarray("MEMBER_NEWFORM_PAYONLINE", $listofval, (getDolGlobalString('MEMBER_NEWFORM_PAYONLINE') ? $conf->global->MEMBER_NEWFORM_PAYONLINE : ''), 0);
|
||||
print $form->selectarray("MEMBER_NEWFORM_PAYONLINE", $listofval, getDolGlobalString('MEMBER_NEWFORM_PAYONLINE'), 0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
@@ -150,10 +150,10 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
|
||||
|
||||
// For business cards
|
||||
if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') {
|
||||
$textleft = make_substitutions($conf->global->ADHERENT_CARD_TEXT, $substitutionarray);
|
||||
$textheader = make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray);
|
||||
$textfooter = make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray);
|
||||
$textright = make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray);
|
||||
$textleft = make_substitutions(getDolGlobalString('ADHERENT_CARD_TEXT'), $substitutionarray);
|
||||
$textheader = make_substitutions(getDolGlobalString('ADHERENT_CARD_HEADER_TEXT'), $substitutionarray);
|
||||
$textfooter = make_substitutions(getDolGlobalString('ADHERENT_CARD_FOOTER_TEXT'), $substitutionarray);
|
||||
$textright = make_substitutions(getDolGlobalString('ADHERENT_CARD_TEXT_RIGHT'), $substitutionarray);
|
||||
|
||||
if (is_numeric($foruserid) || $foruserlogin) {
|
||||
$nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY']; // $_Avery_Labels is defined into an include
|
||||
@@ -190,7 +190,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
|
||||
if (!getDolGlobalString('ADHERENT_ETIQUETTE_TEXT')) {
|
||||
$conf->global->ADHERENT_ETIQUETTE_TEXT = "__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY__";
|
||||
}
|
||||
$textleft = make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray);
|
||||
$textleft = make_substitutions(getDolGlobalString('ADHERENT_ETIQUETTE_TEXT'), $substitutionarray);
|
||||
$textheader = '';
|
||||
$textfooter = '';
|
||||
$textright = '';
|
||||
@@ -275,7 +275,7 @@ dol_htmloutput_errors($mesg);
|
||||
|
||||
print '<br>';
|
||||
|
||||
print img_picto('', 'card').' '.$langs->trans("DocForAllMembersCards", (getDolGlobalString('ADHERENT_CARD_TYPE') ? $conf->global->ADHERENT_CARD_TYPE : $langs->transnoentitiesnoconv("None"))).' ';
|
||||
print img_picto('', 'card').' '.$langs->trans("DocForAllMembersCards", getDolGlobalString('ADHERENT_CARD_TYPE', $langs->transnoentitiesnoconv("None"))).' ';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="foruserid" value="all">';
|
||||
@@ -288,13 +288,13 @@ foreach (array_keys($_Avery_Labels) as $codecards) {
|
||||
$arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
|
||||
}
|
||||
asort($arrayoflabels);
|
||||
print $form->selectarray('modelcard', $arrayoflabels, (GETPOST('modelcard') ? GETPOST('modelcard') : (!getDolGlobalString('ADHERENT_CARD_TYPE') ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print $form->selectarray('modelcard', $arrayoflabels, (GETPOST('modelcard') ? GETPOST('modelcard') : getDolGlobalString('ADHERENT_CARD_TYPE')), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print '<br><input type="submit" class="button small" value="'.$langs->trans("BuildDoc").'">';
|
||||
print '</form>';
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
print img_picto('', 'card').' '.$langs->trans("DocForOneMemberCards", (getDolGlobalString('ADHERENT_CARD_TYPE') ? $conf->global->ADHERENT_CARD_TYPE : $langs->transnoentitiesnoconv("None"))).' ';
|
||||
print img_picto('', 'card').' '.$langs->trans("DocForOneMemberCards", getDolGlobalString('ADHERENT_CARD_TYPE', $langs->transnoentitiesnoconv("None"))).' ';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="mode" value="cardlogin">';
|
||||
@@ -306,14 +306,14 @@ foreach (array_keys($_Avery_Labels) as $codecards) {
|
||||
$arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
|
||||
}
|
||||
asort($arrayoflabels);
|
||||
print $form->selectarray('model', $arrayoflabels, (GETPOST('model') ? GETPOST('model') : (!getDolGlobalString('ADHERENT_CARD_TYPE') ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print $form->selectarray('model', $arrayoflabels, (GETPOST('model') ? GETPOST('model') : getDolGlobalString('ADHERENT_CARD_TYPE')), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print '<br>'.$langs->trans("Login").': <input class="with100" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">';
|
||||
print '<br><input type="submit" class="button small" value="'.$langs->trans("BuildDoc").'">';
|
||||
print '</form>';
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
print img_picto('', 'card').' '.$langs->trans("DocForLabels", (!getDolGlobalString('ADHERENT_ETIQUETTE_TYPE') ? '' : $conf->global->ADHERENT_ETIQUETTE_TYPE)).' ';
|
||||
print img_picto('', 'card').' '.$langs->trans("DocForLabels", getDolGlobalString('ADHERENT_ETIQUETTE_TYPE')).' ';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="mode" value="label">';
|
||||
@@ -325,7 +325,7 @@ foreach (array_keys($_Avery_Labels) as $codecards) {
|
||||
$arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
|
||||
}
|
||||
asort($arrayoflabels);
|
||||
print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel') ? GETPOST('modellabel') : (!getDolGlobalString('ADHERENT_ETIQUETTE_TYPE') ? '' : $conf->global->ADHERENT_ETIQUETTE_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel') ? GETPOST('modellabel') : getDolGlobalString('ADHERENT_ETIQUETTE_TYPE')), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print '<br><input type="submit" class="button small" value="'.$langs->trans("BuildDoc").'">';
|
||||
print '</form>';
|
||||
|
||||
|
||||
@@ -1151,7 +1151,6 @@ class Adherent extends CommonObject
|
||||
// Mise a jour
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent";
|
||||
$sql .= " SET pass_crypted = '".$this->db->escape($password_crypted)."'";
|
||||
//if (!empty($conf->global->DATABASE_PWD_ENCRYPTED))
|
||||
if ($isencrypted) {
|
||||
$sql .= ", pass = null";
|
||||
} else {
|
||||
@@ -1921,7 +1920,7 @@ class Adherent extends CommonObject
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
// Generate PDF (whatever is option MAIN_DISABLE_PDF_AUTOUPDATE) so we can include it into email
|
||||
//if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
//if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE'))
|
||||
|
||||
$invoice->generateDocument($invoice->model_pdf, $outputlangs);
|
||||
}
|
||||
@@ -2727,7 +2726,7 @@ class Adherent extends CommonObject
|
||||
$keymodified = false;
|
||||
|
||||
// Object classes
|
||||
$info["objectclass"] = explode(',', $conf->global->LDAP_MEMBER_OBJECT_CLASS);
|
||||
$info["objectclass"] = explode(',', getDolGlobalString('LDAP_MEMBER_OBJECT_CLASS'));
|
||||
|
||||
$this->fullname = $this->getFullName($langs);
|
||||
|
||||
@@ -2752,7 +2751,7 @@ class Adherent extends CommonObject
|
||||
$info[getDolGlobalString($constname)] = $this->$varname;
|
||||
|
||||
// Check if it is the LDAP key and if its value has been changed
|
||||
if (getDolGlobalString('LDAP_KEY_MEMBERS') && $conf->global->LDAP_KEY_MEMBERS == getDolGlobalString($constname)) {
|
||||
if (getDolGlobalString('LDAP_KEY_MEMBERS') && getDolGlobalString('LDAP_KEY_MEMBERS') == getDolGlobalString($constname)) {
|
||||
if (!empty($this->oldcopy) && $this->$varname != $this->oldcopy->$varname) {
|
||||
$keymodified = true; // For check if LDAP key has been modified
|
||||
}
|
||||
@@ -2821,15 +2820,15 @@ class Adherent extends CommonObject
|
||||
if (getDolGlobalString('LDAP_MEMBER_FIELD_PASSWORD_CRYPTED')) {
|
||||
$info[getDolGlobalString('LDAP_MEMBER_FIELD_PASSWORD_CRYPTED')] = dol_hash($this->pass, 'openldap'); // Create OpenLDAP password (see LDAP_PASSWORD_HASH_TYPE)
|
||||
}
|
||||
} elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') {
|
||||
} elseif (getDolGlobalString('LDAP_SERVER_PROTOCOLVERSION') !== '3') {
|
||||
// Set LDAP password if possible
|
||||
// If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password
|
||||
if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
|
||||
// Just for the default MD5 !
|
||||
if (!getDolGlobalString('MAIN_SECURITY_HASH_ALGO')) {
|
||||
if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) { // This should be on on default installation
|
||||
// Just for the case we use old md5 encryption (deprecated, no more used, kept for compatibility)
|
||||
if (!getDolGlobalString('MAIN_SECURITY_HASH_ALGO') || getDolGlobalString('MAIN_SECURITY_HASH_ALGO') == 'md5') {
|
||||
if ($this->pass_indatabase_crypted && getDolGlobalString('LDAP_MEMBER_FIELD_PASSWORD_CRYPTED')) {
|
||||
// Create OpenLDAP MD5 password from Dolibarr MD5 password
|
||||
// Note: This suppose that "pass_indatabase_crypted" is a md5 (guaranted by the previous test if "(empty($conf->global->MAIN_SECURITY_HASH_ALGO))"
|
||||
// Note: This suppose that "pass_indatabase_crypted" is a md5 (this should not happen anymore)"
|
||||
$info[getDolGlobalString('LDAP_MEMBER_FIELD_PASSWORD_CRYPTED')] = dolGetLdapPasswordHash($this->pass_indatabase_crypted, 'md5frommd5');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -844,7 +844,7 @@ class AdherentType extends CommonObject
|
||||
$dn = getDolGlobalString('LDAP_KEY_MEMBERS_TYPES') . "=".$info[getDolGlobalString('LDAP_KEY_MEMBERS_TYPES')]."," . getDolGlobalString('LDAP_MEMBER_TYPE_DN');
|
||||
}
|
||||
if ($mode == 1) {
|
||||
$dn = $conf->global->LDAP_MEMBER_TYPE_DN;
|
||||
$dn = getDolGlobalString('LDAP_MEMBER_TYPE_DN');
|
||||
}
|
||||
if ($mode == 2) {
|
||||
$dn = getDolGlobalString('LDAP_KEY_MEMBERS_TYPES') . "=".$info[getDolGlobalString('LDAP_KEY_MEMBERS_TYPES')];
|
||||
@@ -868,7 +868,7 @@ class AdherentType extends CommonObject
|
||||
$info = array();
|
||||
|
||||
// Object classes
|
||||
$info["objectclass"] = explode(',', $conf->global->LDAP_MEMBER_TYPE_OBJECT_CLASS);
|
||||
$info["objectclass"] = explode(',', getDolGlobalString('LDAP_MEMBER_TYPE_OBJECT_CLASS'));
|
||||
|
||||
if (empty($this->note_public) && !empty($this->note)) { // For backward compatibility
|
||||
$this->note_public = $this->note;
|
||||
|
||||
@@ -41,7 +41,7 @@ if ($user->socid > 0) {
|
||||
$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
|
||||
|
||||
$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));
|
||||
$endyear = $year;
|
||||
|
||||
// Load translation files required by the page
|
||||
|
||||
@@ -43,7 +43,7 @@ if ($user->socid > 0) {
|
||||
$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
|
||||
|
||||
$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));
|
||||
$endyear = $year;
|
||||
|
||||
// Load translation files required by the page
|
||||
|
||||
@@ -1056,7 +1056,7 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h
|
||||
print $langs->trans("CreateDolibarrThirdParty");
|
||||
print '</a>)';
|
||||
}
|
||||
if (!getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS') || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') {
|
||||
if (!getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS') || getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS') != 'defaultforfoundationcountry') {
|
||||
print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
|
||||
}
|
||||
if (getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && (isModEnabled('product') || isModEnabled('service'))) {
|
||||
@@ -1086,7 +1086,7 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h
|
||||
print $langs->trans("CreateDolibarrThirdParty");
|
||||
print '</a>)';
|
||||
}
|
||||
if (!getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS') || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') {
|
||||
if (!getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS') || getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS') != 'defaultforfoundationcountry') {
|
||||
print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
|
||||
}
|
||||
if (getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && (isModEnabled('product')|| isModEnabled('service'))) {
|
||||
|
||||
@@ -41,6 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'admincompany'; // To manage different context of search
|
||||
$page_y = GETPOSTINT('page_y');
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'companies', 'bills'));
|
||||
@@ -137,7 +138,8 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
|
||||
dol_mkdir($dirforimage);
|
||||
}
|
||||
$result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']);
|
||||
if ($result > 0) {
|
||||
|
||||
if (is_numeric($result) && $result > 0) {
|
||||
$constant = "MAIN_INFO_SOCIETE_LOGO";
|
||||
if ($varforimage == 'logo_squarred') {
|
||||
$constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED";
|
||||
@@ -267,7 +269,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
|
||||
}
|
||||
|
||||
if ($action != 'updateedit' && !$error) {
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
header("Location: ".$_SERVER["PHP_SELF"].($page_y ? '?page_y='.$page_y : ''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -426,6 +428,7 @@ if (!empty($conf->use_javascript_ajax)) {
|
||||
print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="page_y" value="">';
|
||||
|
||||
print '<table class="noborder centpercent editmode">';
|
||||
print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->trans("CompanyInfo").'</th><th></th></tr>'."\n";
|
||||
@@ -457,7 +460,7 @@ print '</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td class="wordbreak"><label for="state_id">'.$langs->trans("State").'</label></td><td>';
|
||||
$state_id = 0;
|
||||
if (getDolGlobalString('MAIN_INFO_SOCIETE_STATE')) {
|
||||
$tmp = explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE);
|
||||
$tmp = explode(':', getDolGlobalString('MAIN_INFO_SOCIETE_STATE'));
|
||||
$state_id = $tmp[0];
|
||||
}
|
||||
print img_picto('', 'state', 'class="pictofixedwidth"');
|
||||
@@ -499,7 +502,7 @@ if (isModEnabled('barcode')) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<label for="barcode">'.$langs->trans("Gencod").'</label></td><td>';
|
||||
print '<span class="fa fa-barcode pictofixedwidth"></span>';
|
||||
print '<input name="barcode" id="barcode" class="minwidth150 widthcentpercentminusx maxwidth300" value="'.dol_escape_htmltag((GETPOSTISSET('barcode') ? GETPOST('barcode', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_GENCODE') ? $conf->global->MAIN_INFO_SOCIETE_GENCODE : ''))).'"></td></tr>';
|
||||
print '<input name="barcode" id="barcode" class="minwidth150 widthcentpercentminusx maxwidth300" value="'.dol_escape_htmltag(GETPOSTISSET('barcode') ? GETPOST('barcode', 'alphanohtml') : getDolGlobalString('MAIN_INFO_SOCIETE_GENCOD', '')).'"></td></tr>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -518,6 +521,9 @@ if ($maxmin > 0) {
|
||||
print '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="logo" id="logo" accept="image/*">';
|
||||
print '</div>';
|
||||
if (!empty($mysoc->logo_small)) {
|
||||
print '<div class="inline-block valignmiddle marginrightonly">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a>';
|
||||
print '</div>';
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
|
||||
print '<div class="inline-block valignmiddle">';
|
||||
print '<img style="max-height: 80px; max-width: 200px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">';
|
||||
@@ -531,9 +537,6 @@ if (!empty($mysoc->logo_small)) {
|
||||
print '<img style="max-height: 80px; max-width: 200px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.basename($imgThumbSmall)).'">';
|
||||
print '</div>';
|
||||
}
|
||||
print '<div class="inline-block valignmiddle marginrightonly">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a>';
|
||||
print '</div>';
|
||||
} elseif (!empty($mysoc->logo)) {
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
|
||||
print '<div class="inline-block valignmiddle">';
|
||||
@@ -542,7 +545,7 @@ if (!empty($mysoc->logo_small)) {
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block valignmiddle">';
|
||||
print '<img height="80" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
|
||||
print '<img height="80" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png" title="File has been removed from disk">';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
@@ -560,6 +563,9 @@ if ($maxmin > 0) {
|
||||
print '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="logo_squarred" id="logo_squarred" accept="image/*">';
|
||||
print '</div>';
|
||||
if (!empty($mysoc->logo_squarred_small)) {
|
||||
print '<div class="inline-block valignmiddle marginrightonly">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a>';
|
||||
print '</div>';
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_small)) {
|
||||
print '<div class="inline-block valignmiddle marginrightonly">';
|
||||
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_small).'">';
|
||||
@@ -573,7 +579,6 @@ if (!empty($mysoc->logo_squarred_small)) {
|
||||
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.basename($imgThumbSmall)).'">';
|
||||
print '</div>';
|
||||
}
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||
} elseif (!empty($mysoc->logo_squarred)) {
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred)) {
|
||||
print '<div class="inline-block valignmiddle">';
|
||||
@@ -582,7 +587,7 @@ if (!empty($mysoc->logo_squarred_small)) {
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block valignmiddle">';
|
||||
print '<img height="80" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
|
||||
print '<img height="80" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png" title="File has been removed from disk">';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
@@ -596,8 +601,9 @@ print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print $form->buttonsSaveCancel("Save", '', array(), false, 'reposition');
|
||||
|
||||
print '<br>';
|
||||
print '<br><br>';
|
||||
|
||||
|
||||
// IDs of the company (country-specific)
|
||||
@@ -762,9 +768,12 @@ print '<td class="titlefieldcreate">'.$langs->trans("FiscalYearInformation").'</
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
|
||||
print $formother->select_month(getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? $conf->global->SOCIETE_FISCAL_MONTH_START : '', 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100').'</td></tr>';
|
||||
print $formother->select_month(getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? $conf->global->SOCIETE_FISCAL_MONTH_START : '', 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100').'</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
print $form->buttonsSaveCancel("Save", '', array(), false, 'reposition');
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
@@ -947,7 +956,7 @@ if ($mysoc->country_code == 'GR') {
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
print $form->buttonsSaveCancel("Save", '');
|
||||
print $form->buttonsSaveCancel("Save", '', array(), false, 'reposition');
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
@@ -128,11 +128,11 @@ foreach ($listofnetworks as $key => $value) {
|
||||
$networkconstname = 'MAIN_INFO_SOCIETE_'.strtoupper($key).'_URL';
|
||||
$networkconstid = 'MAIN_INFO_SOCIETE_'.strtoupper($key);
|
||||
print '<td class="nowraponall"><span class="paddingright fab '.($value['icon'] ? $value['icon'] : 'fa-link').'"></span>';
|
||||
print '<input name="'.$key.'" id="'.$key.'" class="minwidth300" value="'.(!empty($conf->global->$networkconstid) ? dol_escape_htmltag($conf->global->$networkconstid) : '').'">';
|
||||
print '<input name="'.$key.'" id="'.$key.'" class="minwidth300" value="'.(!empty($conf->global->$networkconstid) ? dol_escape_htmltag(getDolGlobalString($networkconstid)) : '').'">';
|
||||
print '</td><td>';
|
||||
print '<input name="'.$key.'url" id="'.$key.'url" class="minwidth300" value="'.(!empty($conf->global->$networkconstname) ? dol_escape_htmltag($conf->global->$networkconstname) : '').'">';
|
||||
print '<input name="'.$key.'url" id="'.$key.'url" class="minwidth300" value="'.(!empty($conf->global->$networkconstname) ? dol_escape_htmltag(getDolGlobalString($networkconstname)) : '').'">';
|
||||
print '</td>';
|
||||
print '<td class="nowraponall">'.dol_print_socialnetworks((!empty($conf->global->$networkconstid) ? dol_escape_htmltag($conf->global->$networkconstid) : ''), 0, 0, $key, $listofnetworks).'</td>';
|
||||
print '<td class="nowraponall">'.dol_print_socialnetworks((!empty($conf->global->$networkconstid) ? dol_escape_htmltag(getDolGlobalString($networkconstid)) : ''), 0, 0, $key, $listofnetworks).'</td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ if ($action == 'edit') {
|
||||
print '<br>';
|
||||
|
||||
|
||||
if (!getDolGlobalString('MAIN_DISABLE_METEO') || $conf->global->MAIN_DISABLE_METEO != 1) {
|
||||
if (!getDolGlobalString('MAIN_DISABLE_METEO') || getDolGlobalInt('MAIN_DISABLE_METEO') != 1) {
|
||||
// Show logo for weather
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescWeather").'</span> ';
|
||||
|
||||
|
||||
@@ -43,8 +43,9 @@ class PrestaShopWebservice
|
||||
/** @var string PS version */
|
||||
protected $version;
|
||||
|
||||
/** @var array compatible versions of PrestaShop Webservice */
|
||||
/** @var string compatible min version of PrestaShop Webservice */
|
||||
const PSCOMPATIBLEVERSIONMIN = '1.4.0.0';
|
||||
/** @var string compatible max version of PrestaShop Webservice */
|
||||
const PSCOMPATIBLEVERSIONMAX = '1.7.99.99';
|
||||
|
||||
|
||||
|
||||
@@ -262,13 +262,13 @@ if ($resql) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="titlefield">'.$langs->trans("Title")."</td>";
|
||||
print '<td><input type="text" class="flat minwidth300" name="external_rss_title_'.$idrss.'" value="'.dol_escape_htmltag($conf->global->$keyrsstitle).'"></td>';
|
||||
print '<td><input type="text" class="flat minwidth300" name="external_rss_title_'.$idrss.'" value="'.dol_escape_htmltag(getDolGlobalString($keyrsstitle)).'"></td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".$langs->trans("URL")."</td>";
|
||||
print '<td><input type="text" class="flat minwidth300" name="external_rss_urlrss_'.$idrss.'" value="'.dol_escape_htmltag($conf->global->$keyrssurl).'"></td>';
|
||||
print '<td><input type="text" class="flat minwidth300" name="external_rss_urlrss_'.$idrss.'" value="'.dol_escape_htmltag(getDolGlobalString($keyrssurl)).'"></td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
|
||||
@@ -707,7 +707,7 @@ if ($action == 'edit') {
|
||||
|
||||
// SMTPS PW
|
||||
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') != "XOAUTH2") {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./', '*', $conf->global->MAIN_MAIL_SMTPS_PW).'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./', '*', getDolGlobalString('MAIN_MAIL_SMTPS_PW')).'</td></tr>';
|
||||
}
|
||||
|
||||
// SMTPS oauth service
|
||||
@@ -918,7 +918,7 @@ if ($action == 'edit') {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
|
||||
print '<td>';
|
||||
if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO')) {
|
||||
$listofemail = explode(',', $conf->global->MAIN_MAIL_AUTOCOPY_TO);
|
||||
$listofemail = explode(',', getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO'));
|
||||
$i = 0;
|
||||
foreach ($listofemail as $key => $val) {
|
||||
if ($i) {
|
||||
|
||||
@@ -533,7 +533,7 @@ if ($action == 'edit') {
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') {
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') {
|
||||
// Host server
|
||||
if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') == 'mail')) {
|
||||
//print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
|
||||
@@ -653,8 +653,8 @@ if ($action == 'edit') {
|
||||
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
|
||||
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') {
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'mail' || !$linuxlike) {
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') {
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail' || !$linuxlike) {
|
||||
if (function_exists('fsockopen') && $port && $server) {
|
||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=testconnect">' . $langs->trans("DoTestServerAvailability") . '</a>';
|
||||
}
|
||||
|
||||
@@ -510,7 +510,7 @@ if ($action == 'edit') {
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') && $conf->global->MAIN_MAIL_SENDMODE_TICKET != 'default') {
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') && getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') != 'default') {
|
||||
// Host server
|
||||
if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail')) {
|
||||
//print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
|
||||
@@ -615,8 +615,8 @@ if ($action == 'edit') {
|
||||
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
|
||||
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') && $conf->global->MAIN_MAIL_SENDMODE_TICKET != 'default') {
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE_TICKET != 'mail' || !$linuxlike) {
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') && getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') != 'default') {
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') != 'mail' || !$linuxlike) {
|
||||
if (function_exists('fsockopen') && $port && $server) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect">'.$langs->trans("DoTestServerAvailability").'</a>';
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ if (isset($max)) {
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
print '<input class="flat" name="MAIN_UPLOAD_DOC" type="text" size="6" value="'.dol_escape_htmltag($conf->global->MAIN_UPLOAD_DOC).'"> '.$langs->trans("Kb");
|
||||
print '<input class="flat" name="MAIN_UPLOAD_DOC" type="text" size="6" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_UPLOAD_DOC')).'"> '.$langs->trans("Kb");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@@ -165,7 +165,7 @@ print '<td>';
|
||||
print $form->textwithpicto($langs->trans("UMask"), $langs->trans("UMaskExplanation"));
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
print '<input class="flat" name="MAIN_UMASK" type="text" size="6" value="'.dol_escape_htmltag($conf->global->MAIN_UMASK).'">';
|
||||
print '<input class="flat" name="MAIN_UMASK" type="text" size="6" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_UMASK')).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@@ -200,7 +200,7 @@ print '<td>'.$langs->trans("AntiVirusParam").'<br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("AntiVirusParamExample").'</span>';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" '.(defined('MAIN_ANTIVIRUS_PARAM') ? 'disabled ' : '').'name="MAIN_ANTIVIRUS_PARAM" class="minwidth500imp" value="'.(getDolGlobalString('MAIN_ANTIVIRUS_PARAM') ? dol_escape_htmltag($conf->global->MAIN_ANTIVIRUS_PARAM) : '').'">';
|
||||
print '<input type="text" '.(defined('MAIN_ANTIVIRUS_PARAM') ? 'disabled ' : '').'name="MAIN_ANTIVIRUS_PARAM" class="minwidth500imp" value="'.(getDolGlobalString('MAIN_ANTIVIRUS_PARAM') ? dol_escape_htmltag(getDolGlobalString('MAIN_ANTIVIRUS_PARAM')) : '').'">';
|
||||
if (defined('MAIN_ANTIVIRUS_PARAM')) {
|
||||
print '<br><span class="opacitymedium">'.$langs->trans("ValueIsForcedBySystem").'</span>';
|
||||
}
|
||||
|
||||
@@ -776,7 +776,7 @@ if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('STOCK_SUPPORTS_SERVICES');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("STOCK_SUPPORTS_SERVICES", $arrval, $conf->global->STOCK_SUPPORTS_SERVICES);
|
||||
print $form->selectarray("STOCK_SUPPORTS_SERVICES", $arrval, getDolGlobalString('STOCK_SUPPORTS_SERVICES'));
|
||||
}
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
@@ -186,16 +186,20 @@ if (isModEnabled('multicompany') && $user->entity) {
|
||||
|
||||
|
||||
// Output mode
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
|
||||
print load_fiche_titre($langs->trans("SyslogOutput"), '', '');
|
||||
|
||||
// Mode
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="set">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Type").'</td><td>'.$langs->trans("Value").'</td>';
|
||||
print '<td class="right" colspan="2"><input type="submit" class="button" '.$optionmc.' value="'.$langs->trans("Modify").'"></td>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print '<td class="center width150"><input type="submit" class="button small" '.$optionmc.' value="'.$langs->trans("Modify").'"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
foreach ($syslogModules as $moduleName) {
|
||||
@@ -209,9 +213,9 @@ foreach ($syslogModules as $moduleName) {
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="140">';
|
||||
print '<input class="oddeven" type="checkbox" name="SYSLOG_HANDLERS[]" value="'.$moduleName.'" '.(in_array($moduleName, $activeModules) ? 'checked' : '').($moduleactive <= 0 ? 'disabled' : '').'> ';
|
||||
print $module->getName();
|
||||
print '<td class="nowraponall" width="140">';
|
||||
print '<input class="oddeven" type="checkbox" id="syslog_handler_'.$moduleName.'" name="SYSLOG_HANDLERS[]" value="'.$moduleName.'" '.(in_array($moduleName, $activeModules) ? 'checked' : '').($moduleactive <= 0 ? 'disabled' : '').'> ';
|
||||
print '<label for="syslog_handler_'.$moduleName.'">'.$module->getName().'</label>';
|
||||
if ($moduleName == 'mod_syslog_syslog') {
|
||||
if (!$module->isActive()) {
|
||||
$langs->load("errors");
|
||||
@@ -235,22 +239,23 @@ foreach ($syslogModules as $moduleName) {
|
||||
$value = (isset($option['default']) ? $option['default'] : '');
|
||||
}
|
||||
|
||||
print $option['name'].': <input type="text" class="flat" name="'.$option['constant'].'" value="'.$value.'"'.(isset($option['attr']) ? ' '.$option['attr'] : '').'>';
|
||||
print '<span class="hideonsmartphone opacitymedium">'.$option['name'].': </span><input type="text" class="flat'.(empty($option['css']) ? '' : ' '.$option['css']).'" name="'.dol_escape_htmltag($option['constant']).'" value="'.$value.'"'.(isset($option['attr']) ? ' '.$option['attr'] : '').'>';
|
||||
if (!empty($option['example'])) {
|
||||
print '<br>'.$langs->trans("Example").': '.$option['example'];
|
||||
print '<br>'.$langs->trans("Example").': '.dol_escape_htmltag($option['example']);
|
||||
}
|
||||
|
||||
if ($option['constant'] == 'SYSLOG_FILE' && preg_match('/^DOL_DATA_ROOT\/[^\/]*$/', $value)) {
|
||||
$filelogparam = ' (<a href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file='.basename($value).'">';
|
||||
$filelogparam = ' <a href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file='.basename($value).'">';
|
||||
$filelogparam .= $langs->trans('Download');
|
||||
$filelogparam .= ' '.basename($value).'</a>)';
|
||||
$filelogparam .= img_picto($langs->trans('Download').' '.basename($value), 'download', 'class="paddingleft"');
|
||||
$filelogparam .= '</a>';
|
||||
print $filelogparam;
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td class="left">';
|
||||
print '<td class="center">';
|
||||
if ($module->getInfo()) {
|
||||
print $form->textwithpicto('', $module->getInfo(), 1, 'help');
|
||||
}
|
||||
@@ -262,42 +267,54 @@ foreach ($syslogModules as $moduleName) {
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print "</div>\n";
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
|
||||
print '<br>'."\n\n";
|
||||
|
||||
print load_fiche_titre($langs->trans("SyslogLevel"), '', '');
|
||||
|
||||
// Level
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
|
||||
print load_fiche_titre($langs->trans("SyslogLevel"), '', '');
|
||||
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="setlevel">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td>';
|
||||
print '<td class="right"><input type="submit" class="button" '.$optionmc.' value="'.$langs->trans("Modify").'"></td>';
|
||||
print '<td class="center width150"><input type="submit" class="button small" '.$optionmc.' value="'.$langs->trans("Modify").'"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td width="140">'.$langs->trans("SyslogLevel").'</td>';
|
||||
print '<td colspan="2"><select class="flat" name="level" '.$optionmc.'>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("SyslogLevel").'</td>';
|
||||
print '<td colspan="2"><select class="flat minwidth400" id="level" name="level" '.$optionmc.'>';
|
||||
print '<option value="'.LOG_EMERG.'" '.($conf->global->SYSLOG_LEVEL == LOG_EMERG ? 'SELECTED' : '').'>LOG_EMERG ('.LOG_EMERG.')</option>';
|
||||
print '<option value="'.LOG_ALERT.'" '.($conf->global->SYSLOG_LEVEL == LOG_ALERT ? 'SELECTED' : '').'>LOG_ALERT ('.LOG_ALERT.')</option>';
|
||||
print '<option value="'.LOG_CRIT.'" '.($conf->global->SYSLOG_LEVEL == LOG_CRIT ? 'SELECTED' : '').'>LOG_CRIT ('.LOG_CRIT.')</option>';
|
||||
print '<option value="'.LOG_ERR.'" '.($conf->global->SYSLOG_LEVEL == LOG_ERR ? 'SELECTED' : '').'>LOG_ERR ('.LOG_ERR.')</option>';
|
||||
print '<option value="'.LOG_WARNING.'" '.($conf->global->SYSLOG_LEVEL == LOG_WARNING ? 'SELECTED' : '').'>LOG_WARNING ('.LOG_WARNING.')</option>';
|
||||
print '<option value="'.LOG_NOTICE.'" '.($conf->global->SYSLOG_LEVEL == LOG_NOTICE ? 'SELECTED' : '').'>LOG_NOTICE ('.LOG_NOTICE.')</option>';
|
||||
print '<option value="'.LOG_WARNING.'" '.($conf->global->SYSLOG_LEVEL == LOG_WARNING ? 'SELECTED' : '').'">LOG_WARNING ('.LOG_WARNING.')</option>';
|
||||
print '<option value="'.LOG_NOTICE.'" '.($conf->global->SYSLOG_LEVEL == LOG_NOTICE ? 'SELECTED' : '').' data-html="'.dol_escape_htmltag('LOG_NOTICE ('.LOG_NOTICE.') - <span class="opacitymedium">'.$langs->trans("RecommendedForProduction").'</span>').'">LOG_NOTICE ('.LOG_NOTICE.')</option>';
|
||||
print '<option value="'.LOG_INFO.'" '.($conf->global->SYSLOG_LEVEL == LOG_INFO ? 'SELECTED' : '').'>LOG_INFO ('.LOG_INFO.')</option>';
|
||||
print '<option value="'.LOG_DEBUG.'" '.($conf->global->SYSLOG_LEVEL >= LOG_DEBUG ? 'SELECTED' : '').'>LOG_DEBUG ('.LOG_DEBUG.')</option>';
|
||||
print '<option value="'.LOG_DEBUG.'" '.($conf->global->SYSLOG_LEVEL >= LOG_DEBUG ? 'SELECTED' : '').' data-html="'.dol_escape_htmltag('LOG_DEBUG ('.LOG_DEBUG.') - <span class="opacitymedium">'.$langs->trans("RecommendedForDebug").'</span>').'">LOG_DEBUG ('.LOG_DEBUG.')</option>';
|
||||
print '</select>';
|
||||
|
||||
print ajax_combobox("level");
|
||||
print '</td></tr>';
|
||||
|
||||
if (!empty($conf->loghandlers['mod_syslog_file']) && isModEnabled('cron')) {
|
||||
print '<tr class="oddeven"><td width="140">'.$langs->trans("SyslogFileNumberOfSaves").'</td>';
|
||||
print '<td colspan="2"><input type="number" name="file_saves" placeholder="14" min="0" step="1" value="'.getDolGlobalString('SYSLOG_FILE_SAVES').'" />';
|
||||
print ' (<a href="'.dol_buildpath('/cron/list.php', 1).'?search_label=CompressSyslogs&status=-1">'.$langs->trans('ConfigureCleaningCronjobToSetFrequencyOfSaves').'</a>)</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("SyslogFileNumberOfSaves").'</td>';
|
||||
print '<td colspan="2"><input class="width50" type="number" name="file_saves" placeholder="14" min="0" step="1" value="'.getDolGlobalString('SYSLOG_FILE_SAVES').'" />';
|
||||
print ' (<a href="'.dol_buildpath('/cron/list.php', 1).'?search_label=CompressSyslogs&status=-1">'.$langs->trans('ConfigureCleaningCronjobToSetFrequencyOfSaves').'</a>)</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print "</div>\n";
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
// End of page
|
||||
|
||||
@@ -350,7 +350,7 @@ print '<span class="bold"> -> PHP streams allowed = </span>';
|
||||
$arrayofstreams = stream_get_wrappers();
|
||||
if (!empty($arrayofstreams)) {
|
||||
sort($arrayofstreams);
|
||||
print (join(',', $arrayofstreams)).' <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("TryToKeepOnly", 'file,http,https,php').')</span>'."\n";
|
||||
print(join(',', $arrayofstreams)).' <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("TryToKeepOnly", 'file,http,https,php').')</span>'."\n";
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
@@ -627,13 +627,13 @@ print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.getDolGlobalString('MAIN_SEC
|
||||
if (!getDolGlobalString('MAIN_SECURITY_HASH_ALGO')) {
|
||||
print '<span class="opacitymedium"> If unset: \'md5\'</span>';
|
||||
}
|
||||
if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
|
||||
if (getDolGlobalString('MAIN_SECURITY_HASH_ALGO') != 'password_hash') {
|
||||
print '<br><strong>MAIN_SECURITY_SALT</strong> = '.getDolGlobalString('MAIN_SECURITY_SALT', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').'<br>';
|
||||
} else {
|
||||
print '<span class="opacitymedium">('.$langs->trans("Recommended").': password_hash)</span>';
|
||||
print '<br>';
|
||||
}
|
||||
if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
|
||||
if (getDolGlobalString('MAIN_SECURITY_HASH_ALGO') != 'password_hash') {
|
||||
print '<div class="info">The recommanded value for MAIN_SECURITY_HASH_ALGO is now \'password_hash\' but setting it now will make ALL existing passwords of all users not valid, so update is not possible.<br>';
|
||||
print 'If you really want to switch, you must:<br>';
|
||||
print '- Go on home - setup - other and add constant MAIN_SECURITY_HASH_ALGO to value \'password_hash\'<br>';
|
||||
@@ -713,7 +713,9 @@ print '<strong>MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES</strong> = '.(getDol
|
||||
print ' <span class="opacitymedium">('.$langs->trans("Recommended").": 1 - does not work on HTML5 with some old libxml libs)</span><br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_DISALLOW_URL_INTO_DESCRIPTIONS</strong> = '.getDolGlobalString('MAIN_DISALLOW_URL_INTO_DESCRIPTIONS', '<span class="opacitymedium">'.$langs->trans("Undefined").' ('.$langs->trans("Recommended").': 1)</span>')."<br>";
|
||||
// MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 1, disallow url links except if on /medias
|
||||
// MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 2, disallow all external urls link
|
||||
print '<strong>MAIN_DISALLOW_URL_INTO_DESCRIPTIONS</strong> = '.getDolGlobalString('MAIN_DISALLOW_URL_INTO_DESCRIPTIONS', '<span class="opacitymedium">'.$langs->trans("Undefined").' ('.$langs->trans("Recommended").': 1=only local links allowed or 2=no links at all)</span>')."<br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_ALLOW_SVG_FILES_AS_EXTERNAL_LINKS</strong> = '.getDolGlobalString('MAIN_ALLOW_SVG_FILES_AS_EXTERNAL_LINKS', '<span class="opacitymedium">'.$langs->trans("Undefined").' ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>')."<br>";
|
||||
|
||||
@@ -47,7 +47,7 @@ if (getDolGlobalString('API_EXPLORER_DISABLED')) {
|
||||
|
||||
// Restrict API to some IPs
|
||||
if (getDolGlobalString('API_RESTRICT_ON_IP')) {
|
||||
$allowedip = explode(' ', $conf->global->API_RESTRICT_ON_IP);
|
||||
$allowedip = explode(' ', getDolGlobalString('API_RESTRICT_ON_IP'));
|
||||
$ipremote = getUserRemoteIP();
|
||||
if (!in_array($ipremote, $allowedip)) {
|
||||
dol_syslog('Remote ip is '.$ipremote.', not into list ' . getDolGlobalString('API_RESTRICT_ON_IP'));
|
||||
|
||||
@@ -2097,7 +2097,7 @@ class Setup extends DolibarrApi
|
||||
$constvalue = (empty($constvalue) ? '0' : $constvalue);
|
||||
// Value found
|
||||
$value = '';
|
||||
if ($constname && $conf->global->$constname != '') {
|
||||
if ($constname && getDolGlobalString($constname) != '') {
|
||||
$value = $conf->global->$constname;
|
||||
}
|
||||
$valueforchecksum = (empty($value) ? '0' : $value);
|
||||
|
||||
@@ -198,7 +198,7 @@ UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain',
|
||||
|
||||
// Restrict API to some IPs
|
||||
if (getDolGlobalString('API_RESTRICT_ON_IP')) {
|
||||
$allowedip = explode(' ', $conf->global->API_RESTRICT_ON_IP);
|
||||
$allowedip = explode(' ', getDolGlobalString('API_RESTRICT_ON_IP'));
|
||||
$ipremote = getUserRemoteIP();
|
||||
if (!in_array($ipremote, $allowedip)) {
|
||||
dol_syslog('Remote ip is '.$ipremote.', not into list ' . getDolGlobalString('API_RESTRICT_ON_IP'));
|
||||
@@ -343,7 +343,7 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
||||
// Test rules on endpoints. For example:
|
||||
// $conf->global->API_ENDPOINT_RULES = 'endpoint1:1,endpoint2:1,...'
|
||||
if (getDolGlobalString('API_ENDPOINT_RULES')) {
|
||||
$listofendpoints = explode(',', $conf->global->API_ENDPOINT_RULES);
|
||||
$listofendpoints = explode(',', getDolGlobalString('API_ENDPOINT_RULES'));
|
||||
$endpointisallowed = false;
|
||||
|
||||
foreach ($listofendpoints as $endpointrule) {
|
||||
|
||||
@@ -155,7 +155,7 @@ if ($resql) {
|
||||
}
|
||||
}
|
||||
|
||||
$seledted = !getDolGlobalString('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY') ? array() : explode(',', $conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY);
|
||||
$seledted = !getDolGlobalString('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY') ? array() : explode(',', getDolGlobalString('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY'));
|
||||
|
||||
print $form->multiselectarray('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY', $countryArray, $seledted);
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||
|
||||
@@ -442,7 +442,6 @@ print '</td>';
|
||||
// User
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
|
||||
|
||||
print '</td>';
|
||||
|
||||
// Actions code
|
||||
@@ -570,7 +569,7 @@ if (is_array($blocks)) {
|
||||
print '<td class="nowraponall">'.dol_print_date($block->date_creation, 'dayhour').'</td>';
|
||||
|
||||
// User
|
||||
print '<td>';
|
||||
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($block->user_fullname).'">';
|
||||
//print $block->getUser()
|
||||
print dol_escape_htmltag($block->user_fullname);
|
||||
print '</td>';
|
||||
@@ -580,7 +579,7 @@ if (is_array($blocks)) {
|
||||
|
||||
// Ref
|
||||
print '<td class="nowraponall">';
|
||||
print $block->ref_object;
|
||||
print dol_escape_htmltag($block->ref_object);
|
||||
print '</td>';
|
||||
|
||||
// Link to source object
|
||||
@@ -596,7 +595,7 @@ if (is_array($blocks)) {
|
||||
print '<td class="center"><a href="#" data-blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
|
||||
|
||||
// Fingerprint
|
||||
print '<td class="nowrap">';
|
||||
print '<td class="nowraponall">';
|
||||
$texttoshow = $langs->trans("Fingerprint").' - '.$langs->trans("Saved").':<br>'.$block->signature;
|
||||
$texttoshow .= '<br><br>'.$langs->trans("Fingerprint").' - Recalculated sha256(previoushash * data):<br>'.$checkdetail[$block->id]['calculatedsignature'];
|
||||
$texttoshow .= '<br><span class="opacitymedium">'.$langs->trans("PreviousHash").'='.$checkdetail[$block->id]['previoushash'].'</span>';
|
||||
|
||||
@@ -211,7 +211,7 @@ class BlockedLog
|
||||
// Add more action to track from a conf variable
|
||||
// For example: STOCK_MOVEMENT,...
|
||||
if (getDolGlobalString('BLOCKEDLOG_ADD_ACTIONS_SUPPORTED')) {
|
||||
$tmparrayofmoresupportedevents = explode(',', $conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED);
|
||||
$tmparrayofmoresupportedevents = explode(',', getDolGlobalString('BLOCKEDLOG_ADD_ACTIONS_SUPPORTED'));
|
||||
foreach ($tmparrayofmoresupportedevents as $val) {
|
||||
$this->trackedevents[$val] = 'log'.$val;
|
||||
}
|
||||
|
||||
@@ -1683,7 +1683,7 @@ if (empty($mode) || $mode == 'show_month') { // View by month
|
||||
|
||||
$maxnbofchar = 80;
|
||||
|
||||
$tmp = explode('-', $conf->global->MAIN_DEFAULT_WORKING_HOURS);
|
||||
$tmp = explode('-', getDolGlobalString('MAIN_DEFAULT_WORKING_HOURS'));
|
||||
$minhour = round($tmp[0], 0);
|
||||
$maxhour = round($tmp[1], 0);
|
||||
if ($minhour > 23) {
|
||||
|
||||
@@ -70,7 +70,7 @@ $now = dol_now();
|
||||
|
||||
//restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0);
|
||||
if (!$user->hasRight('propal', 'read') && !$user->hasRight('supplier_proposal', 'read') && !$user->hasRight('commande', 'read') && !$user->hasRight('fournisseur', 'commande', 'read')
|
||||
&& !$user->hasRight('supplier_order', 'read') && !$user->hasRight('fichinter', 'read')) {
|
||||
&& !$user->hasRight('supplier_order', 'read') && !$user->hasRight('fichinter', 'read') && !$user->hasRight('contrat', 'read')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@@ -1512,7 +1512,7 @@ class Propal extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if (!$error && !getDolGlobalInt('MAIN_IGNORE_CONTACTS_ON_CLONING')) {
|
||||
// copy internal contacts
|
||||
if ($object->copy_linked_contact($this, 'internal') < 0) {
|
||||
$error++;
|
||||
@@ -2720,7 +2720,7 @@ class Propal extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
|
||||
if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE') && !getDolGlobalInt('PROPAL_DISABLE_AUTOUPDATE_ON_CLOSE')) {
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS')) {
|
||||
|
||||
@@ -54,7 +54,7 @@ if ($user->socid > 0) {
|
||||
|
||||
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear;
|
||||
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));
|
||||
$endyear = $year;
|
||||
|
||||
// Load translation files required by the page
|
||||
|
||||
@@ -1191,7 +1191,7 @@ class Commande extends CommonOrder
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016-2023 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2018-2023 Charlene Benke <charlene@patas-monkey.com>
|
||||
* Copyright (C) 2021 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -322,6 +322,8 @@ if (empty($reshook)) {
|
||||
}
|
||||
$uploaddir = $conf->commande->multidir_output[$conf->entity];
|
||||
$triggersendname = 'ORDER_SENTBYMAIL';
|
||||
$year="";
|
||||
$month="";
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
if ($massaction == 'confirm_createbills') { // Create bills from orders.
|
||||
|
||||
@@ -75,7 +75,7 @@ if ($user->socid > 0) {
|
||||
|
||||
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$year = GETPOST('year') > 0 ? GETPOST('year') : $nowyear;
|
||||
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));
|
||||
$endyear = $year;
|
||||
|
||||
// Load translation files required by the page
|
||||
|
||||
@@ -1079,7 +1079,7 @@ if ($resql) {
|
||||
}
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields
|
||||
$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) : ''); // This also change content of $arrayfields
|
||||
// When action is 'reconcile', we force to have the column num_releve always enabled (otherwise we can't make reconciliation).
|
||||
if ($action == 'reconcile') {
|
||||
$arrayfields['b.num_releve']['checked'] = 1;
|
||||
@@ -1088,12 +1088,16 @@ if ($resql) {
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
// Fields title search
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre_filter">';
|
||||
// Actions and select
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre valignmiddle center">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
|
||||
$searchpicto = $form->showFilterButtons('left');
|
||||
print $searchpicto;
|
||||
//$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
|
||||
//print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['b.rowid']['checked'])) {
|
||||
@@ -1171,77 +1175,105 @@ if ($resql) {
|
||||
if (!empty($arrayfields['b.fk_bordereau']['checked'])) {
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_fk_bordereau" value="'.dol_escape_htmltag($search_fk_bordereau).'" size="3"></td>';
|
||||
}
|
||||
// Action edit/delete and select
|
||||
print '<td class="nowraponall" align="center"></td>';
|
||||
|
||||
// Actions and select
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre valignmiddle center">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
|
||||
//$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
|
||||
//print $searchpicto;
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
|
||||
// Fields title
|
||||
print '<tr class="liste_titre">';
|
||||
// Actions and select
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ');
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['b.rowid']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['b.rowid']['label'], $_SERVER['PHP_SELF'], 'b.rowid', '', $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['b.label']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['b.label']['label'], $_SERVER['PHP_SELF'], 'b.label', '', $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['b.dateo']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['b.dateo']['label'], $_SERVER['PHP_SELF'], 'b.dateo', '', $param, '', $sortfield, $sortorder, "center ");
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['b.datev']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['b.datev']['label'], $_SERVER['PHP_SELF'], 'b.datev,b.dateo,b.rowid', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['type']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['type']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['b.num_chq']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['b.num_chq']['label'], $_SERVER['PHP_SELF'], 'b.num_chq', '', $param, '', $sortfield, $sortorder, "center ");
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['bu.label']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['bu.label']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['ba.ref']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['b.debit']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, "right ");
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['b.credit']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, "right ");
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['balancebefore']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['balancebefore']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, "right ");
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['balance']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['balance']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, "right ");
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['b.num_releve']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['b.num_releve']['label'], $_SERVER['PHP_SELF'], 'b.num_releve', '', $param, '', $sortfield, $sortorder, "center ");
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['b.conciliated']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['b.conciliated']['label'], $_SERVER['PHP_SELF'], 'b.rappro', '', $param, '', $sortfield, $sortorder, "center ");
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['b.fk_bordereau']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['b.fk_bordereau']['label'], $_SERVER['PHP_SELF'], 'b.fk_bordereau', '', $param, '', $sortfield, $sortorder, "center ");
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action edit/delete and select
|
||||
print '<td class="nowraponall" align="center"></td>';
|
||||
$totalarray['nbfield']++;
|
||||
// Actions and select
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
//print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
@@ -1251,10 +1283,15 @@ if ($resql) {
|
||||
$posconciliatecol = 0;
|
||||
$cachebankaccount = array();
|
||||
|
||||
// Loop on each record
|
||||
$sign = 1;
|
||||
|
||||
while ($i < min($num, $limit)) {
|
||||
// Loop on each record
|
||||
$i = 0;
|
||||
$savnbfield = $totalarray['nbfield'];
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
while ($i < $imaxinloop) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
$links = $bankaccountstatic->get_url($objp->rowid);
|
||||
|
||||
@@ -1364,13 +1401,17 @@ if ($resql) {
|
||||
</script>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// conciliate
|
||||
print '<td colspan="'.($tmpnbfieldafterbalance).'">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td></td>';
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
@@ -1411,6 +1452,7 @@ if ($resql) {
|
||||
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td>';
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) {
|
||||
@@ -1814,9 +1856,14 @@ if ($resql) {
|
||||
print '</a>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td>';
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($objp->rowid, $arrayofselected)) {
|
||||
@@ -1872,7 +1919,7 @@ if ($resql) {
|
||||
$colspan++;
|
||||
}
|
||||
}
|
||||
print '<tr><td colspan="'.($colspan + 1).'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
print '<tr><td colspan="'.($colspan + 1).'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
@@ -590,7 +590,7 @@ class Account extends CommonObject
|
||||
|
||||
// Check parameters
|
||||
if (!$oper) {
|
||||
$this->error = "oper not defined";
|
||||
$this->error = "Operation code not defined";
|
||||
return -1;
|
||||
}
|
||||
if (!$this->id) {
|
||||
|
||||
@@ -258,25 +258,38 @@ if ($user->hasRight('banque', 'consolidate') && ($action == 'num_releve' || $act
|
||||
}
|
||||
$sql .= " WHERE rowid = ".((int) $rowid);
|
||||
|
||||
dol_syslog("line.php", LOG_DEBUG);
|
||||
$updatePathFile = true;
|
||||
$update_dir = true;
|
||||
|
||||
dol_syslog("line.php update bank line to set the new bank receipt nuber", LOG_DEBUG);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
// We must not rename the directory of the bank receipt when we change 1 line of bank receipt. Other lines may share the same old ref.
|
||||
// Renaming can be done when we rename globaly a bank receipt but not when changing 1 line from one receipt into another one.
|
||||
/*
|
||||
if ($result) {
|
||||
$oldfilepath = dol_sanitizePathName("bank/".((int) $id)."/statement/".$oldNum_rel);
|
||||
$filepath = dol_sanitizePathName("bank/".((int) $id)."/statement/".$num_rel);
|
||||
if ($oldNum_rel) {
|
||||
if ($num_rel) {
|
||||
$oldfilepath = dol_sanitizePathName("bank/".((int) $id)."/statement/".$oldNum_rel);
|
||||
$filepath = dol_sanitizePathName("bank/".((int) $id)."/statement/".$num_rel);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."ecm_files";
|
||||
$sql .= " SET filepath = '".$db->escape($filepath)."'";
|
||||
$sql .= " WHERE filepath = '".$db->escape($oldfilepath)."'";
|
||||
$updatePathFile = $db->query($sql);
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."ecm_files";
|
||||
$sql .= " SET filepath = '".$db->escape($filepath)."'";
|
||||
$sql .= " WHERE filepath = '".$db->escape($oldfilepath)."'";
|
||||
$updatePathFile = $db->query($sql);
|
||||
|
||||
$srcdir = dol_sanitizePathName(DOL_DATA_ROOT."/bank/".((int) $id)."/statement/".$oldNum_rel);
|
||||
$destdir = dol_sanitizePathName(DOL_DATA_ROOT."/bank/".((int) $id)."/statement/".$num_rel);
|
||||
$srcdir = dol_sanitizePathName(DOL_DATA_ROOT."/bank/".((int) $id)."/statement/".$oldNum_rel);
|
||||
$destdir = dol_sanitizePathName(DOL_DATA_ROOT."/bank/".((int) $id)."/statement/".$num_rel);
|
||||
|
||||
$update_dir = true;
|
||||
if (dol_is_dir($srcdir)) {
|
||||
$update_dir = dol_move_dir($srcdir, $destdir, 1);
|
||||
if (dol_is_dir($srcdir)) {
|
||||
$update_dir = dol_move_dir($srcdir, $destdir, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if ($result && $updatePathFile && $update_dir) {
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
$db->commit();
|
||||
|
||||
@@ -416,7 +416,7 @@ if ($action == "create" || $action == "start" || $action == 'close') {
|
||||
print '<td>';
|
||||
|
||||
$array = array();
|
||||
$numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS);
|
||||
$numterminals = max(1, getDolGlobalString('TAKEPOS_NUM_TERMINALS'));
|
||||
for ($i = 1; $i <= $numterminals; $i++) {
|
||||
$array[$i] = $i;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ if ($userid > 0) {
|
||||
|
||||
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$year = GETPOST('year') > 0 ? GETPOST('year') : $nowyear;
|
||||
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));
|
||||
$endyear = $year;
|
||||
|
||||
$mode = GETPOST("mode") ? GETPOST("mode") : 'customer';
|
||||
|
||||
@@ -165,7 +165,7 @@ $permissiontoadd = $usercancreate; // Used by the include of actions_addupdatede
|
||||
// retained warranty invoice available type
|
||||
$retainedWarrantyInvoiceAvailableType = array();
|
||||
if (getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY')) {
|
||||
$retainedWarrantyInvoiceAvailableType = explode('+', $conf->global->INVOICE_USE_RETAINED_WARRANTY);
|
||||
$retainedWarrantyInvoiceAvailableType = explode('+', getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY'));
|
||||
}
|
||||
|
||||
// Security check
|
||||
@@ -1684,7 +1684,7 @@ if (empty($reshook)) {
|
||||
if (!isset($conf->global->CONTRACT_EXCLUDE_SERVICES_STATUS_FOR_INVOICE)) {
|
||||
$conf->global->CONTRACT_EXCLUDE_SERVICES_STATUS_FOR_INVOICE = '5';
|
||||
}
|
||||
if ($srcobject->element == 'contrat' && in_array($lines[$i]->statut, explode(',', $conf->global->CONTRACT_EXCLUDE_SERVICES_STATUS_FOR_INVOICE))) {
|
||||
if ($srcobject->element == 'contrat' && in_array($lines[$i]->statut, explode(',', getDolGlobalString('CONTRACT_EXCLUDE_SERVICES_STATUS_FOR_INVOICE')))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -181,8 +181,6 @@ class Facture extends CommonInvoice
|
||||
public $fk_facture_source;
|
||||
public $linked_objects = array();
|
||||
|
||||
public $date_lim_reglement;
|
||||
|
||||
/**
|
||||
* @var int ID Field to store bank id to use when payment mode is withdraw
|
||||
*/
|
||||
@@ -5534,7 +5532,7 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
|
||||
if ($rounding < 0) {
|
||||
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
$rounding = min(getDolGlobalString('MAIN_MAX_DECIMALS_UNIT'), $conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
}
|
||||
|
||||
if ($rounding > 0) {
|
||||
|
||||
@@ -214,7 +214,7 @@ $arrayfields = array(
|
||||
'f.subtype'=>array('label'=>"InvoiceSubtype", 'checked'=>0, 'position'=>17),
|
||||
'f.date_lim_reglement'=>array('label'=>"DateDue", 'checked'=>1, 'position'=>25),
|
||||
'f.date_closing'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>30),
|
||||
'p.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(!isModEnabled('project') ? 0 : 1), 'position'=>40),
|
||||
'p.ref'=>array('label'=>"ProjectRef", 'langs'=>'projects', 'checked'=>1, 'enabled'=>(!isModEnabled('project') ? 0 : 1), 'position'=>40),
|
||||
'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(!isModEnabled('project') ? 0 : 1), 'position'=>41),
|
||||
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>50),
|
||||
's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>1, 'position'=>51),
|
||||
@@ -910,38 +910,6 @@ $parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
// We disable this. It create a bug when searching with sall and sorting on status. Also it create performance troubles.
|
||||
/*
|
||||
if (!$sall) {
|
||||
$sql .= ' GROUP BY f.rowid, f.ref, ref_client, f.fk_soc, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total_ht, f.total_tva, f.total_ttc,';
|
||||
$sql .= ' f.localtax1, f.localtax2,';
|
||||
$sql .= ' f.datef, f.date_valid, f.date_lim_reglement, f.module_source, f.pos_source,';
|
||||
$sql .= ' f.paye, f.fk_statut, f.close_code,';
|
||||
$sql .= ' f.datec, f.tms, f.date_closing,';
|
||||
$sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
|
||||
$sql .= ' f.fk_user_author, f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht,';
|
||||
$sql .= ' f.multicurrency_total_tva, f.multicurrency_total_ttc,';
|
||||
$sql .= ' s.rowid, s.nom, s.name_alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,';
|
||||
$sql .= ' typent.code,';
|
||||
$sql .= ' state.code_departement, state.nom,';
|
||||
$sql .= ' country.code,';
|
||||
$sql .= " p.rowid, p.ref, p.title,";
|
||||
$sql .= " u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender";
|
||||
if ($search_categ_cus && $search_categ_cus != -1) {
|
||||
$sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||
}
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
|
||||
}
|
||||
}
|
||||
// Add GroupBy from hooks
|
||||
$parameters = array('all' => !empty($all) ? $all : 0, 'fieldstosearchall' => $fieldstosearchall);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
} else {
|
||||
*/
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
}
|
||||
@@ -1708,6 +1676,7 @@ if (!empty($arrayfields['f.date_lim_reglement']['checked'])) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['p.ref']['checked'])) {
|
||||
$langs->load("projects");
|
||||
print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER['PHP_SELF'], "p.ref", '', $param, '', $sortfield, $sortorder);
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ if ($user->socid > 0) {
|
||||
|
||||
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear;
|
||||
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
|
||||
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));
|
||||
$endyear = $year;
|
||||
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.
|
||||
|
||||
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink);
|
||||
|
||||
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
|
||||
$p = explode(":", getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY'));
|
||||
$idpays = $p[0];
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ $result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
// les variables
|
||||
$cptfour = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"));
|
||||
$cptfour = ((getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"));
|
||||
$cpttva = (getDolGlobalString('ACCOUNTING_VAT_BUY_ACCOUNT') ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
|
||||
$tabfac = array();
|
||||
|
||||
@@ -107,7 +107,7 @@ if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) {
|
||||
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
|
||||
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink);
|
||||
|
||||
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
|
||||
$p = explode(":", getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY'));
|
||||
$idpays = $p[0];
|
||||
|
||||
$sql = "SELECT f.rowid, f.ref, f.type, f.datef, f.ref_client,";
|
||||
@@ -165,7 +165,7 @@ if ($result) {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
// les variables
|
||||
$cptcli = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"));
|
||||
$cptcli = ((getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"));
|
||||
$compta_soc = (!empty($obj->code_compta) ? $obj->code_compta : $cptcli);
|
||||
$compta_prod = $obj->accountancy_code_sell;
|
||||
if (empty($compta_prod)) {
|
||||
|
||||
@@ -55,7 +55,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
|
||||
$date_start = dol_get_first_day($year_start, GETPOST("month"), false);
|
||||
$date_end = dol_get_last_day($year_start, GETPOST("month"), false);
|
||||
} else {
|
||||
$date_start = dol_get_first_day($year_start, !getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false);
|
||||
$date_start = dol_get_first_day($year_start, !getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false);
|
||||
if (!getDolGlobalString('MAIN_INFO_VAT_RETURN') || getDolGlobalInt('MAIN_INFO_VAT_RETURN') == 2) {
|
||||
$date_end = dol_time_plus_duree($date_start, 3, 'm') - 1;
|
||||
} elseif (getDolGlobalInt('MAIN_INFO_VAT_RETURN') == 3) {
|
||||
|
||||
@@ -65,7 +65,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
|
||||
$date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false);
|
||||
$date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false);
|
||||
} else {
|
||||
$date_start = dol_get_first_day($year_start, !getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false);
|
||||
$date_start = dol_get_first_day($year_start, !getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false);
|
||||
if (!getDolGlobalString('MAIN_INFO_VAT_RETURN') || getDolGlobalInt('MAIN_INFO_VAT_RETURN') == 2) {
|
||||
$date_end = dol_time_plus_duree($date_start, 3, 'm') - 1;
|
||||
} elseif (getDolGlobalInt('MAIN_INFO_VAT_RETURN') == 3) {
|
||||
|
||||
@@ -391,7 +391,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
}
|
||||
if ($(\'#fieldchqemetteur\').val() == \'\')
|
||||
{
|
||||
var emetteur = ('.$facture->type.' == '.Facture::TYPE_CREDIT_NOTE.') ? \''.dol_escape_js(dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM)).'\' : jQuery(\'#thirdpartylabel\').val();
|
||||
var emetteur = ('.$facture->type.' == '.Facture::TYPE_CREDIT_NOTE.') ? \''.dol_escape_js(dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SOCIETE_NOM'))).'\' : jQuery(\'#thirdpartylabel\').val();
|
||||
$(\'#fieldchqemetteur\').val(emetteur);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,21 +92,23 @@ $totaltoshow = 0;
|
||||
if (isModEnabled('supplier_invoice')) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("NbOfInvoiceToPayByBankTransfer").'</td>';
|
||||
print '<td class="right">';
|
||||
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/prelevement/demandes.php?status=0&type=bank-transfer">';
|
||||
$amounttoshow = $bprev->SommeAPrelever('bank-transfer');
|
||||
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/prelevement/demandes.php?status=0&type=bank-transfer" title="'.price($amounttoshow).'">';
|
||||
print $bprev->nbOfInvoiceToPay('bank-transfer');
|
||||
print '</a>';
|
||||
print '</td></tr>';
|
||||
$totaltoshow += $bprev->SommeAPrelever('bank-transfer');
|
||||
$totaltoshow += $amounttoshow;
|
||||
}
|
||||
|
||||
if (isModEnabled('salaries')) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("NbOfInvoiceToPayByBankTransferForSalaries").'</td>';
|
||||
print '<td class="right">';
|
||||
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/prelevement/demandes.php?status=0&type=bank-transfer&sourcetype=salary">';
|
||||
$amounttoshow = $bprev->SommeAPrelever('bank-transfer', 'salary');
|
||||
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/prelevement/demandes.php?status=0&type=bank-transfer&sourcetype=salary" title="'.price($amounttoshow).'">';
|
||||
print $bprev->nbOfInvoiceToPay('bank-transfer', 'salary');
|
||||
print '</a>';
|
||||
print '</td></tr>';
|
||||
$totaltoshow += $bprev->SommeAPrelever('bank-transfer', 'salary');
|
||||
$totaltoshow += $amounttoshow;
|
||||
}
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Total").'</td>';
|
||||
@@ -116,18 +118,15 @@ print '</span></td></tr></table></div><br>';
|
||||
|
||||
|
||||
/*
|
||||
* Invoices waiting for withdraw
|
||||
* Invoices waiting for credit transfer
|
||||
*/
|
||||
if (isModEnabled('supplier_invoice')) {
|
||||
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type, f.datef, f.date_lim_reglement,";
|
||||
$sql .= " pfd.date_demande, pfd.amount,";
|
||||
$sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
$sql .= " WHERE s.rowid = f.fk_soc";
|
||||
$sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
|
||||
$sql .= " AND f.total_ttc > 0";
|
||||
@@ -137,17 +136,10 @@ if (isModEnabled('supplier_invoice')) {
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
$sql .= " AND pfd.fk_facture_fourn = f.rowid";
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND f.fk_soc = ".((int) $socid);
|
||||
}
|
||||
|
||||
$sqlForSalary = "SELECT * FROM ".MAIN_DB_PREFIX."salary as s, ".MAIN_DB_PREFIX."prelevement_demande as pd";
|
||||
$sqlForSalary .= " WHERE s.rowid = pd.fk_salary AND s.paye = 0 AND pd.traite = 0";
|
||||
$sqlForSalary .= " AND s.entity IN (".getEntity('salary').")";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ($resql) {
|
||||
@@ -219,6 +211,10 @@ if (isModEnabled('supplier_invoice')) {
|
||||
}
|
||||
|
||||
if (isModEnabled('salaries')) {
|
||||
$sqlForSalary = "SELECT * FROM ".MAIN_DB_PREFIX."salary as s, ".MAIN_DB_PREFIX."prelevement_demande as pd";
|
||||
$sqlForSalary .= " WHERE s.rowid = pd.fk_salary AND s.paye = 0 AND pd.traite = 0";
|
||||
$sqlForSalary .= " AND s.entity IN (".getEntity('salary').")";
|
||||
|
||||
$resql2 = $db->query($sqlForSalary);
|
||||
if ($resql2) {
|
||||
$numRow = $db->num_rows($resql2);
|
||||
|
||||
@@ -149,14 +149,14 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Set direct debit order to credited, create payment and close invoices
|
||||
if ($action == 'infocredit' && $permissiontocreditdebit) {
|
||||
if ($action == 'setinfocredit' && $permissiontocreditdebit) {
|
||||
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
|
||||
if (($object->type != 'bank-transfer' && $object->statut == BonPrelevement::STATUS_CREDITED) || ($object->type == 'bank-transfer' && $object->statut == BonPrelevement::STATUS_DEBITED)) {
|
||||
$error = 1;
|
||||
setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors');
|
||||
} else {
|
||||
$error = $object->set_infocredit($user, $dt);
|
||||
$error = $object->set_infocredit($user, $dt, ($salaryBonPl ? 'salary' : ''));
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
@@ -164,6 +164,14 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'reopen' && $permissiontocreditdebit) {
|
||||
$savtype = $object->type;
|
||||
$res = $object->setStatut(BonPrelevement::STATUS_TRANSFERED);
|
||||
if ($res <= 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $permissiontodelete) {
|
||||
$savtype = $object->type;
|
||||
$res = $object->delete($user);
|
||||
@@ -386,11 +394,11 @@ if ($id > 0 || $ref) {
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
if (!empty($object->date_trans) && empty($object->date_credit) && (($user->hasRight('prelevement', 'bons', 'credit') && $object->type != 'bank-transfer') || ($user->hasRight('paymentbybanktransfer', 'debit') && $object->type == 'bank-transfer')) && $action == 'setcredited') {
|
||||
if ($object->status == BonPrelevement::STATUS_TRANSFERED && (($user->hasRight('prelevement', 'bons', 'credit') && $object->type != 'bank-transfer') || ($user->hasRight('paymentbybanktransfer', 'debit') && $object->type == 'bank-transfer')) && $action == 'setcredited') {
|
||||
$btnLabel = ($object->type == 'bank-transfer') ? $langs->trans("ClassDebited") : $langs->trans("ClassCredited");
|
||||
print '<form name="infocredit" method="post" action="card.php?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="infocredit">';
|
||||
print '<input type="hidden" name="action" value="setinfocredit">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("NotifyCredit").'</td></tr>';
|
||||
@@ -417,7 +425,8 @@ if ($id > 0 || $ref) {
|
||||
print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->hasRight('prelevement', 'bons', 'send'));
|
||||
}
|
||||
}
|
||||
if (!empty($object->date_trans) && empty($object->date_credit)) {
|
||||
|
||||
if ($object->status == BonPrelevement::STATUS_TRANSFERED) {
|
||||
if ($object->type == 'bank-transfer') {
|
||||
print dolGetButtonAction($langs->trans("ClassDebited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->hasRight('paymentbybanktransfer', 'debit'));
|
||||
} else {
|
||||
@@ -425,6 +434,16 @@ if ($id > 0 || $ref) {
|
||||
}
|
||||
}
|
||||
|
||||
if (getDolGlobalString('BANK_CAN_REOPEN_DIRECT_DEBIT_OR_CREDIT_TRANSFER')) {
|
||||
if ($object->status == BonPrelevement::STATUS_DEBITED || $object->status == BonPrelevement::STATUS_CREDITED) {
|
||||
if ($object->type == 'bank-transfer') {
|
||||
print dolGetButtonAction($langs->trans("ReOpen"), '', 'default', 'card.php?action=reopen&token='.newToken().'&id='.$object->id, '', $user->hasRight('paymentbybanktransfer', 'debit'));
|
||||
} else {
|
||||
print dolGetButtonAction($langs->trans("ReOpen"), '', 'default', 'card.php?action=reopen&token='.newToken().'&id='.$object->id, '', $user->hasRight('prelevement', 'bons', 'credit'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($object->type == 'bank-transfer') {
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->hasRight('paymentbybanktransfer', 'create'));
|
||||
} else {
|
||||
@@ -437,15 +456,21 @@ if ($id > 0 || $ref) {
|
||||
|
||||
$ligne = new LignePrelevement($db);
|
||||
|
||||
/*
|
||||
* Lines into withdraw request
|
||||
*/
|
||||
// Lines into withdraw request
|
||||
if ($salaryBonPl) {
|
||||
$sql = "SELECT pl.rowid, pl.statut, pl.amount,pl.fk_user";
|
||||
$sql .=" FROM llx_prelevement as p, llx_prelevement_lignes as pl, llx_salary as s";
|
||||
$sql .= " WHERE pl.rowid = p.fk_prelevement_lignes";
|
||||
$sql .= " AND p.fk_salary = s.rowid";
|
||||
$sql .= " AND pl.fk_prelevement_bons = ".((int) $id);
|
||||
$sql = "SELECT pl.rowid, pl.statut, pl.amount, pl.fk_user,";
|
||||
$sql .= " u.rowid as socid, u.login as name";
|
||||
$sql .=" FROM llx_prelevement_lignes as pl";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $id);
|
||||
$sql .= " AND pl.fk_prelevement_bons = pb.rowid";
|
||||
$sql .= " AND pb.entity = ".((int) $conf->entity); // No sharing of entity here
|
||||
$sql .= " AND pl.fk_user = u.rowid";
|
||||
if ($socid) {
|
||||
$sql .= " AND u.rowid = ".((int) $socid);
|
||||
}
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
} else {
|
||||
$sql = "SELECT pl.rowid, pl.statut, pl.amount,";
|
||||
$sql .= " s.rowid as socid, s.nom as name";
|
||||
|
||||
@@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php';
|
||||
|
||||
@@ -186,8 +187,6 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
$this->filename = '';
|
||||
@@ -217,7 +216,7 @@ class BonPrelevement extends CommonObject
|
||||
/**
|
||||
* Add invoice to withdrawal
|
||||
*
|
||||
* @param int $invoice_id id invoice to add
|
||||
* @param int $invoice_id ID of invoice to add or ID of salary to add
|
||||
* @param int $client_id id invoice customer
|
||||
* @param string $client_nom customer name
|
||||
* @param int $amount amount of invoice
|
||||
@@ -226,7 +225,7 @@ class BonPrelevement extends CommonObject
|
||||
* @param string $number bank account number
|
||||
* @param string $number_key number key of account number
|
||||
* @param string $type 'debit-order' or 'bank-transfer'
|
||||
* @param string $sourcetype 'salary' for invoice of salary
|
||||
* @param string $sourcetype 'salary' for salary, '' for invoices
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
public function AddFacture($invoice_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $type = 'debit-order', $sourcetype = '')
|
||||
@@ -235,7 +234,7 @@ class BonPrelevement extends CommonObject
|
||||
$result = 0;
|
||||
$line_id = 0;
|
||||
|
||||
// Add lines
|
||||
// Add lines into prelevement_lignes
|
||||
$result = $this->addline($line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype);
|
||||
|
||||
|
||||
@@ -245,7 +244,7 @@ class BonPrelevement extends CommonObject
|
||||
if ($type != 'bank-transfer') {
|
||||
$sql .= "fk_facture";
|
||||
} else {
|
||||
if (!empty($sourcetype)) {
|
||||
if ($sourcetype == 'salary') {
|
||||
$sql .= "fk_salary";
|
||||
} else {
|
||||
$sql .= "fk_facture_fourn";
|
||||
@@ -280,21 +279,21 @@ class BonPrelevement extends CommonObject
|
||||
/**
|
||||
* Add line to withdrawal
|
||||
*
|
||||
* @param int $line_id id line to add
|
||||
* @param int $client_id id invoice customer
|
||||
* @param int $line_id ID of line added (returned parameter)
|
||||
* @param int $client_id ID of thirdparty for invoices, ID of user for salaries
|
||||
* @param string $client_nom customer name
|
||||
* @param int $amount amount of invoice
|
||||
* @param string $code_banque code of bank withdrawal
|
||||
* @param string $code_guichet code of bank's office
|
||||
* @param string $number bank account number
|
||||
* @param string $number_key number key of account number
|
||||
* @param string $sourcetype check if is salary invoice
|
||||
* @param string $sourcetype 'salary' for salary, '' for invoices
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
public function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype = '')
|
||||
{
|
||||
$result = -1;
|
||||
$concat = 0;
|
||||
$concat = 0; // ??? what is this for. Seems not used.
|
||||
|
||||
if ($concat == 1) {
|
||||
/*
|
||||
@@ -303,10 +302,10 @@ class BonPrelevement extends CommonObject
|
||||
$sql = "SELECT rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes";
|
||||
$sql .= " WHERE fk_prelevement_bons = ".((int) $this->id);
|
||||
if (empty($sourcetype)) {
|
||||
$sql .= " AND fk_soc =".((int) $client_id);
|
||||
if ($sourcetype == 'salary') {
|
||||
$sql .= " AND fk_soc = ".((int) $client_id);
|
||||
} else {
|
||||
$sql .= " AND fk_user =".((int) $client_id);
|
||||
$sql .= " AND fk_user = ".((int) $client_id);
|
||||
}
|
||||
$sql .= " AND code_banque = '".$this->db->escape($code_banque)."'";
|
||||
$sql .= " AND code_guichet = '".$this->db->escape($code_guichet)."'";
|
||||
@@ -331,17 +330,17 @@ class BonPrelevement extends CommonObject
|
||||
$sql .= ", code_guichet";
|
||||
$sql .= ", number";
|
||||
$sql .= ", cle_rib";
|
||||
$sql .= (!empty($sourcetype) ? ", fk_user" : "");
|
||||
$sql .= ($sourcetype == 'salary' ? ", fk_user" : "");
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= $this->id;
|
||||
$sql .= ", ".(empty($sourcetype) ? ((int) $client_id) : 0);
|
||||
$sql .= ", ".(($sourcetype != 'salary') ? ((int) $client_id) : "0"); // fk_soc can't be null
|
||||
$sql .= ", '".$this->db->escape($client_nom)."'";
|
||||
$sql .= ", ".((float) price2num($amount));
|
||||
$sql .= ", '".$this->db->escape($code_banque)."'";
|
||||
$sql .= ", '".$this->db->escape($code_guichet)."'";
|
||||
$sql .= ", '".$this->db->escape($number)."'";
|
||||
$sql .= ", '".$this->db->escape($number_key)."'";
|
||||
$sql .= (!empty($sourcetype) ? ", ". ((int) $client_id) : '');
|
||||
$sql .= (($sourcetype == 'salary') ? ", ". ((int) $client_id) : '');
|
||||
$sql .= ")";
|
||||
if ($this->db->query($sql)) {
|
||||
$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes");
|
||||
@@ -451,13 +450,14 @@ class BonPrelevement extends CommonObject
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Set direct debit or credit transfer order to "paid" status.
|
||||
* Then create the payment for each invoice of the prelemevement_bon.
|
||||
* Then create the payment for each invoice or salary of the prelemevement_bon.
|
||||
*
|
||||
* @param User $user Id of user
|
||||
* @param int $date date of action
|
||||
* @param string $type 'salary' for type=salary
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
public function set_infocredit($user, $date)
|
||||
public function set_infocredit($user, $date, $type = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
@@ -475,10 +475,10 @@ class BonPrelevement extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
|
||||
$sql .= " SET fk_user_credit = ".$user->id;
|
||||
$sql .= " SET fk_user_credit = ".((int) $user->id);
|
||||
$sql .= ", statut = ".self::STATUS_CREDITED;
|
||||
$sql .= ", date_credit = '".$this->db->idate($date)."'";
|
||||
$sql .= " WHERE rowid=".((int) $this->id);
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
$sql .= " AND entity = ".((int) $conf->entity);
|
||||
$sql .= " AND statut = ".self::STATUS_TRANSFERED;
|
||||
|
||||
@@ -498,13 +498,21 @@ class BonPrelevement extends CommonObject
|
||||
$amounts = array();
|
||||
$amountsperthirdparty = array();
|
||||
|
||||
$facs = $this->getListInvoices(1);
|
||||
$facs = $this->getListInvoices(1, $type);
|
||||
if ($this->error) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Loop on each invoice. $facs=array(0=>id, 1=>amount requested)
|
||||
// Loop on each invoice or salary.
|
||||
// $facs should be array(0=>id, 1=>amount requested)
|
||||
$num = count($facs);
|
||||
for ($i = 0; $i < $num; $i++) {
|
||||
if ($this->type == 'bank-transfer') {
|
||||
$fac = new FactureFournisseur($this->db);
|
||||
if ($type == 'salary') {
|
||||
$fac = new Salary($this->db);
|
||||
} else {
|
||||
$fac = new FactureFournisseur($this->db);
|
||||
}
|
||||
} else {
|
||||
$fac = new Facture($this->db);
|
||||
}
|
||||
@@ -512,15 +520,34 @@ class BonPrelevement extends CommonObject
|
||||
$result = $fac->fetch($facs[$i][0]);
|
||||
|
||||
$amounts[$fac->id] = $facs[$i][1];
|
||||
$amountsperthirdparty[$fac->socid][$fac->id] = $facs[$i][1];
|
||||
if ($this->type == 'bank-transfer') {
|
||||
if ($type == 'salary') {
|
||||
$amountsperthirdparty[$fac->fk_user][$fac->id] = $facs[$i][1];
|
||||
} else {
|
||||
$amountsperthirdparty[$fac->socid][$fac->id] = $facs[$i][1];
|
||||
}
|
||||
} else {
|
||||
$amountsperthirdparty[$fac->socid][$fac->id] = $facs[$i][1];
|
||||
}
|
||||
|
||||
$totalpaid = $fac->getSommePaiement();
|
||||
$totalcreditnotes = $fac->getSumCreditNotesUsed();
|
||||
$totaldeposits = $fac->getSumDepositsUsed();
|
||||
$totalcreditnotes = 0;
|
||||
if (method_exists($fac, 'getSumCreditNotesUsed')) {
|
||||
$totalcreditnotes = $fac->getSumCreditNotesUsed();
|
||||
}
|
||||
$totaldeposits = 0;
|
||||
if (method_exists($fac, 'getSumDepositsUsed')) {
|
||||
$totaldeposits = $fac->getSumDepositsUsed();
|
||||
}
|
||||
$alreadypayed = $totalpaid + $totalcreditnotes + $totaldeposits;
|
||||
|
||||
// @TODO Move this after creation of payment
|
||||
if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) {
|
||||
// Set the main document to pay with status Paid.
|
||||
// @TODO Move this after creation of payments done after
|
||||
$amountofdocument = $fac->total_ttc;
|
||||
if ($type == 'salary') {
|
||||
$amountofdocument = $fac->amount;
|
||||
}
|
||||
if (price2num($alreadypayed + $facs[$i][1], 'MT') == price2num($amountofdocument, 'MT')) {
|
||||
$result = $fac->setPaid($user);
|
||||
if ($result < 0) {
|
||||
$this->error = $fac->error;
|
||||
@@ -528,12 +555,15 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
//var_dump($amountsperthirdparty);exit;
|
||||
|
||||
// Make one payment per customer
|
||||
// Make one payment per customer or employee
|
||||
foreach ($amountsperthirdparty as $thirdpartyid => $cursoramounts) {
|
||||
if ($this->type == 'bank-transfer') {
|
||||
$paiement = new PaiementFourn($this->db);
|
||||
if ($type == 'salary') {
|
||||
$paiement = new PaymentSalary($this->db);
|
||||
} else {
|
||||
$paiement = new PaiementFourn($this->db);
|
||||
}
|
||||
} else {
|
||||
$paiement = new Paiement($this->db);
|
||||
}
|
||||
@@ -541,8 +571,16 @@ class BonPrelevement extends CommonObject
|
||||
$paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice
|
||||
|
||||
if ($this->type == 'bank-transfer') {
|
||||
$paiement->paiementid = 2;
|
||||
$paiement->paiementcode = 'VIR';
|
||||
if ($type == 'salary') {
|
||||
$paiement->datep = $date;
|
||||
|
||||
$paiement->paiementid = 2;
|
||||
$paiement->fk_typepayment = 2;
|
||||
$paiement->paiementcode = 'VIR';
|
||||
} else {
|
||||
$paiement->paiementid = 2;
|
||||
$paiement->paiementcode = 'VIR';
|
||||
}
|
||||
} else {
|
||||
$paiement->paiementid = 3;
|
||||
$paiement->paiementcode = 'PRE';
|
||||
@@ -551,17 +589,24 @@ class BonPrelevement extends CommonObject
|
||||
$paiement->num_payment = $this->ref; // Set ref of direct debit note
|
||||
$paiement->id_prelevement = $this->id;
|
||||
|
||||
$paiement_id = $paiement->create($user); // This use ->paiementid, that is ID of payment mode
|
||||
if ($paiement_id < 0) {
|
||||
$result = $paiement->create($user); // This use ->paiementid, that is ID of payment mode
|
||||
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->error = $paiement->error;
|
||||
$this->errors = $paiement->errors;
|
||||
dol_syslog(get_class($this)."::set_infocredit AddPayment Error ".$this->error);
|
||||
} else {
|
||||
if ($this->type == 'bank-transfer') {
|
||||
$modeforaddpayment = 'payment_supplier';
|
||||
$labelforaddpayment = '(SupplierInvoicePayment)';
|
||||
$addbankurl = 'credit-transfer';
|
||||
if ($type == 'salary') {
|
||||
$modeforaddpayment = 'payment_salary';
|
||||
$labelforaddpayment = '(SalaryPayment)';
|
||||
$addbankurl = 'credit-transfer';
|
||||
} else {
|
||||
$modeforaddpayment = 'payment_supplier';
|
||||
$labelforaddpayment = '(SupplierInvoicePayment)';
|
||||
$addbankurl = 'credit-transfer';
|
||||
}
|
||||
} else {
|
||||
$modeforaddpayment = 'payment';
|
||||
$labelforaddpayment = '(CustomerInvoicePayment)';
|
||||
@@ -569,6 +614,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
$result = $paiement->addPaymentToBank($user, $modeforaddpayment, $labelforaddpayment, $fk_bank_account, '', '', 0, '', $addbankurl);
|
||||
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->error = $paiement->error;
|
||||
@@ -596,12 +642,11 @@ class BonPrelevement extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
|
||||
/*
|
||||
* End of procedure
|
||||
*/
|
||||
// End of procedure
|
||||
if ($error == 0) {
|
||||
$this->date_credit = $date;
|
||||
$this->date_credit = $date; // date credit or debit
|
||||
$this->statut = self::STATUS_CREDITED;
|
||||
$this->status = self::STATUS_CREDITED;
|
||||
|
||||
$this->db->commit();
|
||||
return 0;
|
||||
@@ -618,9 +663,9 @@ class BonPrelevement extends CommonObject
|
||||
/**
|
||||
* Set withdrawal to transmited status
|
||||
*
|
||||
* @param User $user id of user
|
||||
* @param int $date date of action
|
||||
* @param string $method method of transmision to bank (0=Internet, 1=Api...)
|
||||
* @param User $user Id of user
|
||||
* @param int $date Date of action
|
||||
* @param string $method Method of transmision to bank (0=Internet, 1=Api...)
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
public function set_infotrans($user, $date, $method)
|
||||
@@ -631,6 +676,7 @@ class BonPrelevement extends CommonObject
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(get_class($this)."::set_infotrans Start", LOG_INFO);
|
||||
|
||||
if ($this->db->begin()) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons ";
|
||||
$sql .= " SET fk_user_trans = ".$user->id;
|
||||
@@ -639,7 +685,7 @@ class BonPrelevement extends CommonObject
|
||||
$sql .= " , statut = ".self::STATUS_TRANSFERED;
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
$sql .= " AND entity = ".((int) $conf->entity);
|
||||
$sql .= " AND statut = 0";
|
||||
$sql .= " AND statut = ".self::STATUS_DRAFT;
|
||||
|
||||
if ($this->db->query($sql)) {
|
||||
$this->method_trans = $method;
|
||||
@@ -655,8 +701,10 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
if ($error == 0) {
|
||||
$this->date_trans = $date;
|
||||
$this->statut = 1;
|
||||
$this->statut = self::STATUS_TRANSFERED;
|
||||
$this->status = self::STATUS_TRANSFERED;
|
||||
$this->user_trans = $user->id;
|
||||
|
||||
$this->db->commit();
|
||||
|
||||
return 0;
|
||||
@@ -673,41 +721,50 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Get invoice list
|
||||
* Get invoice or salary list (with amount or not)
|
||||
*
|
||||
* @param int $amounts If you want to get the amount of the order for each invoice
|
||||
* @return array Id of invoices
|
||||
* @param int $amounts If you want to get the amount of the order for each invoice or salary
|
||||
* @param string $type 'salary' for type=salary
|
||||
* @return array Array(Id of invoices/salary, Amount to pay)
|
||||
*/
|
||||
private function getListInvoices($amounts = 0)
|
||||
private function getListInvoices($amounts = 0, $type = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$arr = array();
|
||||
|
||||
/*
|
||||
* Returns all invoices presented within same order
|
||||
*/
|
||||
dol_syslog(get_class($this)."::getListInvoices");
|
||||
|
||||
// Returns all invoices presented within same order
|
||||
$sql = "SELECT ";
|
||||
if ($this->type == 'bank-transfer') {
|
||||
$sql .= " p.fk_facture_fourn";
|
||||
if ($type == 'salary') {
|
||||
$sql .= " p.fk_salary";
|
||||
} else {
|
||||
$sql .= " p.fk_facture_fourn";
|
||||
}
|
||||
} else {
|
||||
$sql .= " p.fk_facture";
|
||||
}
|
||||
if ($amounts) {
|
||||
$sql .= ", SUM(pl.amount)";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement as p";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as pb,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
|
||||
$sql .= " WHERE p.fk_prelevement_lignes = pl.rowid";
|
||||
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
|
||||
$sql .= " AND p.rowid = ".((int) $this->id);
|
||||
$sql .= " AND p.entity = ".((int) $conf->entity);
|
||||
$sql .= " AND pl.fk_prelevement_bons = pb.rowid";
|
||||
$sql .= " AND pb.rowid = ".((int) $this->id);
|
||||
$sql .= " AND pb.entity = ".((int) $conf->entity);
|
||||
if ($amounts) {
|
||||
if ($this->type == 'bank-transfer') {
|
||||
$sql .= " GROUP BY fk_facture_fourn";
|
||||
if ($type == 'salary') {
|
||||
$sql .= " GROUP BY p.fk_salary";
|
||||
} else {
|
||||
$sql .= " GROUP BY p.fk_facture_fourn";
|
||||
}
|
||||
} else {
|
||||
$sql .= " GROUP BY fk_facture";
|
||||
$sql .= " GROUP BY p.fk_facture";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -732,7 +789,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
$this->db->free($resql);
|
||||
} else {
|
||||
dol_syslog(get_class($this)."::getListInvoices Erreur");
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
|
||||
return $arr;
|
||||
@@ -749,8 +806,6 @@ class BonPrelevement extends CommonObject
|
||||
public function SommeAPrelever($mode = 'direct-debit', $type = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT sum(pd.amount) as nb";
|
||||
if ($type !== 'salary') {
|
||||
if ($mode != 'bank-transfer') {
|
||||
@@ -817,7 +872,7 @@ class BonPrelevement extends CommonObject
|
||||
* Get number of invoices to pay
|
||||
*
|
||||
* @param string $type 'direct-debit' or 'bank-transfer'
|
||||
* @param int $forsalary 0= for facture & facture_supplier, 1=for salary
|
||||
* @param int $forsalary 0= for facture & facture_supplier, 1=for salary
|
||||
* @return int Return integer <O if KO, number of invoices if OK
|
||||
*/
|
||||
public function NbFactureAPrelever($type = 'direct-debit', $forsalary = 0)
|
||||
@@ -1165,7 +1220,7 @@ class BonPrelevement extends CommonObject
|
||||
if (!$error) {
|
||||
$ref = substr($year, -2).$month;
|
||||
|
||||
// Get next free nuber for the ref of bon
|
||||
// Get next free nunber for the ref of bon prelevement
|
||||
$sql = "SELECT substring(ref from char_length(ref) - 1)"; // To extract "YYMMXX" from "TYYMMXX"
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
|
||||
$sql .= " WHERE ref LIKE '_".$this->db->escape($ref)."%'";
|
||||
@@ -1230,18 +1285,11 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
dol_syslog(__METHOD__." Now loop on each document to insert them in llx_prelevement_demande");
|
||||
|
||||
// Add lines for the bon
|
||||
if (count($factures_prev) > 0) {
|
||||
foreach ($factures_prev as $fac) { // Add a link in database for each invoice ro salary
|
||||
// Fetch invoice
|
||||
/*
|
||||
$result = $fact->fetch($fac[0]);
|
||||
if ($result < 0) {
|
||||
$this->error = 'ERRORBONPRELEVEMENT Failed to load invoice with id '.$fac[0];
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* Add standing order. This add record into llx_prelevement_lignes and llx_prelevement
|
||||
*
|
||||
@@ -1259,7 +1307,6 @@ class BonPrelevement extends CommonObject
|
||||
* $fac[11] : IBAN
|
||||
* $fac[12] : frstrcur
|
||||
*/
|
||||
|
||||
$ri = $this->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $fac[3], $fac[4], $fac[5], $fac[6], $type, $sourcetype);
|
||||
|
||||
if ($ri <> 0) {
|
||||
@@ -1799,7 +1846,7 @@ class BonPrelevement extends CommonObject
|
||||
* Section Creditor (sepa Crediteurs bloc lines)
|
||||
*/
|
||||
if (!empty($user_dest)) {
|
||||
$sql = "SELECT u.rowid as userId, c.code as country_code, CONCAT(u.firstname,' ',u.lastname) as nom,";
|
||||
$sql = "SELECT u.rowid as userId, u.address, u.zip, u.town, c.code as country_code, CONCAT(u.firstname,' ',u.lastname) as nom,";
|
||||
$sql .= " pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
|
||||
$sql .= " s.ref as reffac, p.fk_salary as idfac,";
|
||||
$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, '' as rum, '' as date_rum";
|
||||
@@ -1807,15 +1854,14 @@ class BonPrelevement extends CommonObject
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."salary as s,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."c_country as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."user as u,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."user_rib as rib";
|
||||
$sql .= " WHERE pl.fk_prelevement_bons=".((int) $this->id);
|
||||
$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
|
||||
$sql .= " AND p.fk_salary = s.rowid";
|
||||
$sql .= " AND s.fk_user = u.rowid";
|
||||
$sql .= " AND rib.fk_user = s.fk_user";
|
||||
$sql .= " AND rib.fk_country = c.rowid";
|
||||
} else {
|
||||
$sql = "SELECT soc.rowid as socid, soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
|
||||
$sql .= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
|
||||
@@ -1825,14 +1871,13 @@ class BonPrelevement extends CommonObject
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as soc,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."c_country as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as soc";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON soc.fk_pays = c.rowid,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
|
||||
$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
|
||||
$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
|
||||
$sql .= " AND p.fk_facture_fourn = f.rowid";
|
||||
$sql .= " AND f.fk_soc = soc.rowid";
|
||||
$sql .= " AND soc.fk_pays = c.rowid";
|
||||
$sql .= " AND rib.fk_soc = f.fk_soc";
|
||||
$sql .= " AND rib.default_rib = 1";
|
||||
$sql .= " AND rib.type = 'ban'";
|
||||
@@ -1854,8 +1899,12 @@ class BonPrelevement extends CommonObject
|
||||
$cachearraytotestduplicate[$obj->idfac] = $obj->rowid;
|
||||
|
||||
$daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec);
|
||||
$refobj = $obj->reffac;
|
||||
if (empty($refobj) && !empty($user_dest)) { // If ref of salary not defined, we force a value
|
||||
$refobj = "SAL".$obj->idfac;
|
||||
}
|
||||
|
||||
$fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->reffac, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type, $obj->fac_ref_supplier);
|
||||
$fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $refobj, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type, $obj->fac_ref_supplier);
|
||||
|
||||
$this->total = $this->total + $obj->somme;
|
||||
$i++;
|
||||
@@ -2071,6 +2120,7 @@ class BonPrelevement extends CommonObject
|
||||
fputs($this->file, "\n");
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Write recipient (thirdparty concerned by request)
|
||||
@@ -2120,7 +2170,7 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR .= ' <DrctDbtTxInf>'.$CrLf;
|
||||
$XML_DEBITOR .= ' <PmtId>'.$CrLf;
|
||||
// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
|
||||
$XML_DEBITOR .= ' <EndToEndId>'.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_DEBITOR .= ' <EndToEndId>'.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_DEBITOR .= ' </PmtId>'.$CrLf;
|
||||
$XML_DEBITOR .= ' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
||||
$XML_DEBITOR .= ' <DrctDbtTx>'.$CrLf;
|
||||
@@ -2166,7 +2216,7 @@ class BonPrelevement extends CommonObject
|
||||
$XML_CREDITOR .= ' <CdtTrfTxInf>'.$CrLf;
|
||||
$XML_CREDITOR .= ' <PmtId>'.$CrLf;
|
||||
// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
|
||||
$XML_CREDITOR .= ' <EndToEndId>'.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_CREDITOR .= ' <EndToEndId>'.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_CREDITOR .= ' </PmtId>'.$CrLf;
|
||||
if (!empty($this->sepa_xml_pti_in_ctti)) {
|
||||
$XML_CREDITOR .= ' <PmtTpInf>' . $CrLf;
|
||||
@@ -2302,6 +2352,7 @@ class BonPrelevement extends CommonObject
|
||||
fputs($this->file, "\n");
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Write sender of request (me).
|
||||
@@ -2623,8 +2674,6 @@ class BonPrelevement extends CommonObject
|
||||
public function load_board($user, $mode)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
if ($user->socid) {
|
||||
return -1; // protection pour eviter appel par utilisateur externe
|
||||
}
|
||||
@@ -2739,7 +2788,7 @@ class BonPrelevement extends CommonObject
|
||||
if ($id) {
|
||||
$sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."prelevement_lignes";
|
||||
$sql .= " WHERE fk_prelevement_bons = ".((int) $id);
|
||||
$sql .= " AND fk_soc = 0";
|
||||
$sql .= " AND fk_soc = 0"; // fk_soc can't be NULL
|
||||
$sql .= " AND fk_user IS NOT NULL";
|
||||
|
||||
$num = 0;
|
||||
|
||||
@@ -97,27 +97,28 @@ class RejetPrelevement
|
||||
}
|
||||
|
||||
/**
|
||||
* Create
|
||||
* Create a reject
|
||||
*
|
||||
* @param User $user User object
|
||||
* @param int $id Id
|
||||
* @param string $motif Motif
|
||||
* @param int $date_rejet Date rejet
|
||||
* @param int $date_rejet Date reject
|
||||
* @param int $bonid Bon id
|
||||
* @param int $facturation Facturation
|
||||
* @return void
|
||||
* @param int $facturation 1=Bill the reject
|
||||
* @return int Return >=0 if OK, <0 if KO
|
||||
*/
|
||||
public function create($user, $id, $motif, $date_rejet, $bonid, $facturation = 0)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $langs;
|
||||
|
||||
$error = 0;
|
||||
$this->id = $id;
|
||||
$this->bon_id = $bonid;
|
||||
$now = dol_now();
|
||||
|
||||
dol_syslog("RejetPrelevement::Create id $id");
|
||||
$bankaccount = ($this->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||
dol_syslog("RejetPrelevement::Create id ".$id);
|
||||
|
||||
$bankaccount = ($this->type == 'bank-transfer' ? getDolGlobalString('PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT') : getDolGlobalString('PRELEVEMENT_ID_BANKACCOUNT'));
|
||||
$facs = $this->getListInvoices(1);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
|
||||
@@ -172,30 +173,34 @@ class RejetPrelevement
|
||||
|
||||
$fac->fetch($facs[$i][0]);
|
||||
|
||||
// Make a negative payment
|
||||
//$pai = new Paiement($this->db);
|
||||
$amountrejected = $facs[$i][1];
|
||||
|
||||
// Make a negative payment
|
||||
// Amount must be an array (id of invoice -> amount)
|
||||
$pai->amounts = array();
|
||||
|
||||
/*
|
||||
* We replace the comma with a point otherwise some
|
||||
* PHP installs sends only the part integer negative
|
||||
*/
|
||||
//var_dump($this->type);exit;
|
||||
|
||||
$pai->amounts[$facs[$i][0]] = price2num($amountrejected * -1); // The payment must be negative because it is a refund
|
||||
|
||||
$pai->amounts[$facs[$i][0]] = price2num($facs[$i][1] * ($this->type == 'bank-transfer' ? 1 : -1));
|
||||
$pai->datepaye = $date_rejet;
|
||||
$pai->paiementid = 3; // type of payment: withdrawal
|
||||
$pai->num_paiement = $fac->ref;
|
||||
$pai->num_payment = $fac->ref;
|
||||
$pai->num_paiement = $langs->trans('Rejection').' '.$fac->ref;
|
||||
$pai->num_payment = $langs->trans('Rejection').' '.$fac->ref;
|
||||
$pai->id_prelevement = $this->bon_id;
|
||||
$pai->num_prelevement = $lipre->bon_ref;
|
||||
|
||||
if ($pai->create($this->user) < 0) {
|
||||
// we call with no_commit
|
||||
$error++;
|
||||
dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i][0]);
|
||||
} else {
|
||||
$result = $pai->addPaymentToBank($user, 'payment', '(InvoiceRefused)', $bankaccount, '', '');
|
||||
// We record entry into bank
|
||||
$mode = 'payment';
|
||||
if ($this->type == 'bank-transfer') {
|
||||
$mode = 'payment_supplier';
|
||||
}
|
||||
|
||||
$result = $pai->addPaymentToBank($user, $mode, '(InvoiceRefused)', $bankaccount, '', '');
|
||||
if ($result < 0) {
|
||||
dol_syslog("RejetPrelevement::Create AddPaymentToBan Error");
|
||||
$error++;
|
||||
@@ -220,9 +225,13 @@ class RejetPrelevement
|
||||
if ($error == 0) {
|
||||
dol_syslog("RejetPrelevement::Create Commit");
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
dol_syslog("RejetPrelevement::Create Rollback");
|
||||
$this->db->rollback();
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ llxHeader('', $langs->trans("WithdrawalsReceipts"));
|
||||
if ($id > 0 || $ref) {
|
||||
if ($object->fetch($id, $ref) >= 0) {
|
||||
$head = prelevement_prepare_head($object);
|
||||
|
||||
print dol_get_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/orders_list.php?restore_lastsearch_values=1'.($object->type != 'bank-transfer' ? '' : '&type=bank-transfer').'">'.$langs->trans("BackToList").'</a>';
|
||||
@@ -293,8 +294,9 @@ if ($resql) {
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
|
||||
$massactionbutton = '';
|
||||
$title = ($salaryBonPl ? $langs->trans("Salaries") : ($object->type == 'bank-transfer' ? $langs->trans("SupplierInvoices") : $langs->trans("Invoices")));
|
||||
|
||||
print_barre_liste(($salaryBonPl ? $langs->trans("Salaries") : $langs->trans("Invoices")), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
@@ -308,7 +310,6 @@ if ($resql) {
|
||||
print_liste_field_titre(($salaryBonPl ? "AmountSalary" : "AmountInvoice"), $_SERVER["PHP_SELF"], "f.total_ttc", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "pl.amount", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
$totalinvoices = 0;
|
||||
@@ -340,9 +341,8 @@ if ($resql) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
|
||||
print '<td class="nowraponall">';
|
||||
print($salaryBonPl ? $salarytmp->getNomUrl(1) : $invoicetmp->getNomUrl(1));
|
||||
print ($salaryBonPl ? $salarytmp->getNomUrl(1) : $invoicetmp->getNomUrl(1));
|
||||
print "</td>\n";
|
||||
|
||||
if ($object->type == 'bank-transfer' && !$salaryBonPl) {
|
||||
@@ -376,8 +376,6 @@ if ($resql) {
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
print "<td></td>";
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$totalinvoices += $obj->total_ttc;
|
||||
@@ -403,7 +401,6 @@ if ($resql) {
|
||||
print price($totalamount_requested);
|
||||
print "</td>\n";
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ $error = 0;
|
||||
if ($action == 'confirm_rejet' && $permissiontoadd) {
|
||||
if (GETPOST("confirm") == 'yes') {
|
||||
if (GETPOST('remonth', 'int')) {
|
||||
$daterej = mktime(2, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
$daterej = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
}
|
||||
|
||||
if (empty($daterej)) {
|
||||
@@ -108,10 +108,12 @@ if ($action == 'confirm_rejet' && $permissiontoadd) {
|
||||
if ($lipre->fetch($id) == 0) {
|
||||
$rej = new RejetPrelevement($db, $user, $type);
|
||||
|
||||
$rej->create($user, $id, GETPOST('motif', 'alpha'), $daterej, $lipre->bon_rowid, GETPOST('facturer', 'int'));
|
||||
$result = $rej->create($user, $id, GETPOST('motif', 'alpha'), $daterej, $lipre->bon_rowid, GETPOST('facturer', 'int'));
|
||||
|
||||
header("Location: line.php?id=".urlencode($id).'&type='.urlencode($type));
|
||||
exit;
|
||||
if ($result > 0) {
|
||||
header("Location: line.php?id=".urlencode($id).'&type='.urlencode($type));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$action = "rejet";
|
||||
@@ -202,30 +204,35 @@ if ($id) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// Form to record a reject
|
||||
if ($action == 'rejet' && $user->hasRight('prelevement', 'bons', 'credit')) {
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($lipre->socid);
|
||||
|
||||
$rej = new RejetPrelevement($db, $user, $type);
|
||||
|
||||
print '<form name="confirm_rejet" method="post" action="line.php?id='.$id.'">';
|
||||
print '<form name="confirm_rejet" method="post" action="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$id.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="confirm_rejet">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("WithdrawalRefused").'</td></tr>';
|
||||
print '<td>'.$langs->trans("WithdrawalRefused").'</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
//Select yes/no
|
||||
print '<tr><td class="valid">'.$langs->trans("WithdrawalRefusedConfirm").' '.$soc->name.' ?</td>';
|
||||
print '<td colspan="2" class="valid">';
|
||||
print '<td class="valid">';
|
||||
print $form->selectyesno("confirm", 1, 0);
|
||||
print '</td></tr>';
|
||||
|
||||
//Date
|
||||
print '<tr><td class="fieldrequired valid">'.$langs->trans("RefusedData").'</td>';
|
||||
print '<td colspan="2" class="valid">';
|
||||
print '<td class="valid">';
|
||||
print $form->selectDate('', '', '', '', '', "confirm_rejet");
|
||||
print '</td></tr>';
|
||||
|
||||
@@ -236,11 +243,15 @@ if ($id) {
|
||||
print '</td></tr>';
|
||||
|
||||
//Facturer
|
||||
print '<tr><td class="valid">'.$langs->trans("RefusedInvoicing").'</td>';
|
||||
print '<td class="valid" colspan="2">';
|
||||
print $form->selectarray("facturer", $rej->labelsofinvoicing, GETPOSTISSET('facturer') ? GETPOST('facturer', 'int') : '');
|
||||
print '<tr><td class="fieldrequired valid">';
|
||||
print $form->textwithpicto($langs->trans("RefusedInvoicing"), $langs->trans("DirectDebitRefusedInvoicingDesc"));
|
||||
print '</td>';
|
||||
print '<td class="valid">';
|
||||
print $form->selectarray("facturer", $rej->labelsofinvoicing, GETPOSTISSET('facturer') ? GETPOST('facturer', 'int') : '', 0);
|
||||
print '</td></tr>';
|
||||
print '</table><br>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
//Confirm Button
|
||||
print '<div class="center"><input type="submit" class="button button-save" value='.$langs->trans("Confirm").'></div>';
|
||||
@@ -274,6 +285,9 @@ if ($id) {
|
||||
$sql = "SELECT pf.rowid";
|
||||
$sql .= " ,f.rowid as facid, f.ref as ref, f.total_ttc, f.paye, f.fk_statut";
|
||||
$sql .= " , s.rowid as socid, s.nom as name";
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement as pf";
|
||||
@@ -296,6 +310,30 @@ if ($id) {
|
||||
if ($socid) {
|
||||
$sql .= " AND s.rowid = ".((int) $socid);
|
||||
}
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->plimit($conf->liste_limit + 1, $offset);
|
||||
|
||||
@@ -306,8 +344,12 @@ if ($id) {
|
||||
$i = 0;
|
||||
|
||||
$urladd = "&id=".urlencode($id);
|
||||
$title = $langs->trans("Bills");
|
||||
if ($type == 'bank-transfer') {
|
||||
$title = $langs->trans("SupplierInvoices");
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("Bills"), $page, "factures.php", $urladd, $sortfield, $sortorder, '', $num, 0, '');
|
||||
print_barre_liste($title, $page, "factures.php", $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
|
||||
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<table class="noborder" width="100%" cellpadding="4">';
|
||||
|
||||
@@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies'));
|
||||
@@ -83,14 +85,16 @@ if ($sortfield == "") {
|
||||
|
||||
$rej = new RejetPrelevement($db, $user, $type);
|
||||
$line = new LignePrelevement($db);
|
||||
$thirdpartystatic = new Societe($db);
|
||||
$userstatic = new User($db);
|
||||
|
||||
$hookmanager->initHooks(array('withdrawalsreceiptsrejectedlist'));
|
||||
|
||||
|
||||
// List of invoices
|
||||
|
||||
$sql = "SELECT pl.rowid, pr.motif, p.ref, pl.statut, p.rowid as bonId";
|
||||
$sql .= " , s.rowid as socid, s.nom as name, p.datec";
|
||||
$sql = "SELECT pl.rowid, pr.motif, p.ref, pl.statut, p.rowid as bonId,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, p.datec";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_rejet as pr";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||
@@ -98,19 +102,20 @@ $sql .= " , ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE pr.fk_prelevement_lignes = pl.rowid";
|
||||
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
|
||||
$sql .= " AND pl.fk_soc = s.rowid";
|
||||
$sql .= " AND p.entity = ".$conf->entity;
|
||||
$sql .= " AND p.entity = ".((int) $conf->entity);
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= " AND p.type = 'bank-transfer'";
|
||||
} else {
|
||||
$sql .= " AND p.type = 'debit-order'";
|
||||
}
|
||||
if ($socid) {
|
||||
if ($socid > 0) {
|
||||
$sql .= " AND s.rowid = ".((int) $socid);
|
||||
}
|
||||
// Add list for salaries
|
||||
if ($type == 'bank-transfer') {
|
||||
$sql .= " UNION";
|
||||
$sql .= " SELECT pl.rowid, pr.motif, p.ref, pl.statut, p.rowid as bonId";
|
||||
$sql .= " ,u.rowid as socid, CONCAT(u.firstname,' ', u.lastname) as name, p.datec";
|
||||
$sql .= " SELECT pl.rowid, pr.motif, p.ref, pl.statut, p.rowid as bonId,";
|
||||
$sql .= " u.rowid as socid, CONCAT(u.firstname,' ', u.lastname) as name, p.datec";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_rejet as pr";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||
@@ -118,7 +123,7 @@ if ($type == 'bank-transfer') {
|
||||
$sql .= " WHERE pr.fk_prelevement_lignes = pl.rowid";
|
||||
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
|
||||
$sql .= " AND pl.fk_user = u.rowid";
|
||||
$sql .= " AND p.entity = ".$conf->entity;
|
||||
$sql .= " AND p.entity = ".((int) $conf->entity);
|
||||
$sql .= " AND p.type = 'bank-transfer'";
|
||||
if ($socid) {
|
||||
$sql .= " AND s.rowid = ".((int) $socid);
|
||||
@@ -129,10 +134,10 @@ if ($type == 'bank-transfer') {
|
||||
}
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
$param = '';
|
||||
|
||||
@@ -147,7 +152,9 @@ if ($result) {
|
||||
|
||||
$bon = new BonPrelevement($db);
|
||||
if ($num) {
|
||||
while ($i < min($num, $limit)) {
|
||||
$i = 0;
|
||||
$maxlim = min($num, $limit);
|
||||
while ($i < $maxlim) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$bon->fetch($obj->bonId);
|
||||
|
||||
@@ -157,10 +164,14 @@ if ($result) {
|
||||
print $line->LibStatut($obj->statut, 2).' ';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'">';
|
||||
print substr('000000'.$obj->rowid, -6)."</a></td>";
|
||||
|
||||
if ($bon->checkIfSalaryBonPrelevement()) {
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/salaries/card.php?id='.$obj->socid.'">'.$obj->nom."</a></td>\n";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/salaries/card.php?id='.$obj->socid.'">'.$obj->name."</a></td>\n";
|
||||
} else {
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.$obj->nom."</a></td>\n";
|
||||
$thirdpartystatic->id = $obj->socid;
|
||||
$thirdpartystatic->name = $obj->name;
|
||||
|
||||
print '<td class="tdoverlowmax200"><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.$thirdpartystatic->getNomUrl(1)."</a></td>\n";
|
||||
}
|
||||
|
||||
print '<td>'.$rej->motifs[$obj->motif].'</td>';
|
||||
|
||||
@@ -79,7 +79,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
|
||||
if ($q == 0) {
|
||||
// We define date_start and date_end
|
||||
$year_end = $year_start + ($nbofyear - 1);
|
||||
$month_start = GETPOST("month", 'int') ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$month_start = GETPOST("month", 'int') ? GETPOST("month", 'int') : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
$date_startmonth = $month_start;
|
||||
if (!GETPOST('month')) {
|
||||
if (!$year && $month_start > $month_current) {
|
||||
|
||||
@@ -63,7 +63,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
|
||||
$q = GETPOST("q", "int");
|
||||
if (empty($q)) {
|
||||
// We define date_start and date_end
|
||||
$month_start = GETPOST("month") ? GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$month_start = GETPOST("month") ? GETPOST("month") : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
$year_end = $year_start;
|
||||
$month_end = $month_start;
|
||||
if (!GETPOST("month")) { // If month not forced
|
||||
@@ -300,7 +300,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="left">'.$langs->trans("Country").'</td>';
|
||||
$i = 0;
|
||||
while ($i < 12) {
|
||||
$j = $i + (!getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
$j = $i + (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -350,7 +350,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
print $langs->trans("Country".$obj->code) != "Country".$obj->code ? $langs->trans("Country".$obj->code) : $obj->country;
|
||||
print '</td>';
|
||||
for ($i = 0; $i < 12; $i++) {
|
||||
$j = $i + (!getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
$j = $i + (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -369,7 +369,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="left"></td>';
|
||||
print '<td></td>';
|
||||
for ($i = 0; $i < 12; $i++) {
|
||||
$j = $i + (!getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
$j = $i + (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -387,7 +387,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="left">'.$langs->trans("Country").'</td>';
|
||||
$i = 0;
|
||||
while ($i < 12) {
|
||||
$j = $i + (!getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
$j = $i + (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -437,7 +437,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
print $langs->trans("Country".$obj->code) != "Country".$obj->code ? $langs->trans("Country".$obj->code) : $obj->country;
|
||||
print '</td>';
|
||||
for ($i = 0; $i < 12; $i++) {
|
||||
$j = $i + (!getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
$j = $i + (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -456,7 +456,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="left"></td>';
|
||||
print '<td></td>';
|
||||
for ($i = 0; $i < 12; $i++) {
|
||||
$j = $i + (!getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
$j = $i + (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
|
||||
$q = GETPOST("q", "int");
|
||||
if (empty($q)) {
|
||||
// We define date_start and date_end
|
||||
$month_start = GETPOST("month") ? GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$month_start = GETPOST("month") ? GETPOST("month") : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
$year_end = $year_start;
|
||||
$month_end = $month_start;
|
||||
if (!GETPOST("month")) { // If month not forced
|
||||
|
||||
@@ -87,7 +87,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
|
||||
$q = GETPOST("q") ? GETPOST("q") : 0;
|
||||
if ($q == 0) {
|
||||
// We define date_start and date_end
|
||||
$month_start = GETPOST("month") ? GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$month_start = GETPOST("month") ? GETPOST("month") : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
$year_end = $year_start;
|
||||
$month_end = $month_start;
|
||||
if (!GETPOST("month")) { // If month not forced
|
||||
|
||||
@@ -110,7 +110,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
|
||||
$q = GETPOST("q", "int") ? GETPOST("q", "int") : 0;
|
||||
if (empty($q)) {
|
||||
// We define date_start and date_end
|
||||
$month_start = GETPOST("month") ? GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$month_start = GETPOST("month") ? GETPOST("month") : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
$year_end = $year_start;
|
||||
$month_end = $month_start;
|
||||
if (!GETPOST("month")) { // If month not forced
|
||||
|
||||
@@ -383,7 +383,7 @@ $now = dol_now();
|
||||
$casenow = dol_print_date($now, "%Y-%m");
|
||||
|
||||
// Loop on each month
|
||||
$nb_mois_decalage = GETPOSTISSET('date_startmonth') ? (GETPOST('date_startmonth', 'int') - 1) : (!getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 0 : ($conf->global->SOCIETE_FISCAL_MONTH_START - 1));
|
||||
$nb_mois_decalage = GETPOSTISSET('date_startmonth') ? (GETPOST('date_startmonth', 'int') - 1) : (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 0 : ($conf->global->SOCIETE_FISCAL_MONTH_START - 1));
|
||||
for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
|
||||
$mois_modulo = $mois; // ajout
|
||||
if ($mois > 12) {
|
||||
|
||||
@@ -87,7 +87,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
|
||||
$q = GETPOST("q", "int");
|
||||
if (empty($q)) {
|
||||
// We define date_start and date_end
|
||||
$month_start = GETPOST("month") ? GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$month_start = GETPOST("month") ? GETPOST("month") : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
$year_end = $year_start;
|
||||
$month_end = $month_start;
|
||||
if (!GETPOST("month")) { // If month not forced
|
||||
|
||||
@@ -97,7 +97,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
|
||||
$q = GETPOST("q", "int") ? GETPOST("q", "int") : 0;
|
||||
if (empty($q)) {
|
||||
// We define date_start and date_end
|
||||
$month_start = GETPOST("month") ? GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$month_start = GETPOST("month") ? GETPOST("month") : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
$year_end = $year_start;
|
||||
$month_end = $month_start;
|
||||
if (!GETPOST("month")) { // If month not forced
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
$now = dol_now();
|
||||
$current_date = dol_getdate($now);
|
||||
if (!getDolGlobalString('SOCIETE_FISCAL_MONTH_START')) {
|
||||
if (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START')) {
|
||||
$conf->global->SOCIETE_FISCAL_MONTH_START = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -781,7 +781,7 @@ class Contact extends CommonObject
|
||||
$info = array();
|
||||
|
||||
// Object classes
|
||||
$info["objectclass"] = explode(',', $conf->global->LDAP_CONTACT_OBJECT_CLASS);
|
||||
$info["objectclass"] = explode(',', getDolGlobalString('LDAP_CONTACT_OBJECT_CLASS'));
|
||||
|
||||
$this->fullname = $this->getFullName($langs);
|
||||
|
||||
|
||||
@@ -68,9 +68,9 @@ $origin = GETPOST('origin', 'alpha');
|
||||
$originid = GETPOST('originid', 'int');
|
||||
|
||||
// PDF
|
||||
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
||||
$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
|
||||
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
|
||||
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0));
|
||||
$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0));
|
||||
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_REF') ? 1 : 0));
|
||||
|
||||
|
||||
$datecontrat = '';
|
||||
|
||||
@@ -3413,7 +3413,7 @@ class ContratLigne extends CommonObjectLine
|
||||
*/
|
||||
public function update($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs, $mysoc;
|
||||
global $mysoc;
|
||||
|
||||
$error = 0;
|
||||
|
||||
@@ -3615,10 +3615,10 @@ class ContratLigne extends CommonObjectLine
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Mise a jour en base des champs total_xxx de ligne
|
||||
* Used by migration process
|
||||
* Update in database the fields total_xxx of lines
|
||||
* Used by migration process
|
||||
*
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function update_total()
|
||||
{
|
||||
@@ -3656,7 +3656,7 @@ class ContratLigne extends CommonObjectLine
|
||||
*/
|
||||
public function insert($notrigger = 0)
|
||||
{
|
||||
global $conf, $user;
|
||||
global $user;
|
||||
|
||||
$error = 0;
|
||||
|
||||
@@ -3753,8 +3753,6 @@ class ContratLigne extends CommonObjectLine
|
||||
public function active_line($user, $date, $date_end = '', $comment = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs, $conf;
|
||||
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
@@ -3813,9 +3811,6 @@ class ContratLigne extends CommonObjectLine
|
||||
public function close_line($user, $date_end_real, $comment = '', $notrigger = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs, $conf;
|
||||
|
||||
// Update object
|
||||
$this->date_cloture = $date_end_real;
|
||||
$this->date_end_real = $date_end_real;
|
||||
$this->user_closing_id = $user->id;
|
||||
|
||||
@@ -410,7 +410,7 @@ if (!$error && $massaction == 'confirm_presend') {
|
||||
$tmp = explode(',', $user->email_aliases);
|
||||
$from = trim($tmp[($reg[1] - 1)]);
|
||||
} elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) {
|
||||
$tmp = explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES);
|
||||
$tmp = explode(',', getDolGlobalString('MAIN_INFO_SOCIETE_MAIL_ALIASES'));
|
||||
$from = trim($tmp[($reg[1] - 1)]);
|
||||
} elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) {
|
||||
$sql = "SELECT rowid, label, email FROM ".MAIN_DB_PREFIX."c_email_senderprofile WHERE rowid = ".(int) $reg[1];
|
||||
@@ -751,7 +751,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto
|
||||
$result = $objecttmp->fetch($toselectid);
|
||||
if ($result > 0) {
|
||||
$listofobjectid[$toselectid] = $toselectid;
|
||||
$thirdpartyid = $objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid;
|
||||
$thirdpartyid = !empty($objecttmp->fk_soc) ? $objecttmp->fk_soc : $objecttmp->socid;
|
||||
$listofobjectthirdparties[$thirdpartyid] = $thirdpartyid;
|
||||
$listofobjectref[$toselectid] = $objecttmp->ref;
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
|
||||
$tmp = explode(',', $user->email_aliases);
|
||||
$from = trim($tmp[($reg[1] - 1)]);
|
||||
} elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) {
|
||||
$tmp = explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES);
|
||||
$tmp = explode(',', getDolGlobalString('MAIN_INFO_SOCIETE_MAIL_ALIASES'));
|
||||
$from = trim($tmp[($reg[1] - 1)]);
|
||||
} elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) {
|
||||
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile';
|
||||
@@ -328,7 +328,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
|
||||
$deliveryreceipt = GETPOST('deliveryreceipt');
|
||||
|
||||
if ($action == 'send' || $action == 'relance') {
|
||||
$actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto, 4, 0, 1);
|
||||
$actionmsg2 = $langs->transnoentities('MailSentByTo', CMailFile::getValidAddress($from, 4, 0, 1), CMailFile::getValidAddress($sendto, 4, 0, 1));
|
||||
/*if ($message) {
|
||||
$actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2019-2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2019-2023 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -16,9 +16,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/ajax/pingresult.php
|
||||
* \brief Page called after a ping was done in js to the official dolibarr ping service.
|
||||
* This ajax URL is called with parameter 'firstpingok' or 'firstpingko' depending on the result of the ping.
|
||||
* \file htdocs/core/ajax/pingresult.php
|
||||
* \brief Page called after a ping was done in js to the official dolibarr ping service.
|
||||
* This ajax URL is called with parameter 'firstpingok' or 'firstpingko' depending on the result of the ping.
|
||||
* You can use &forceping=1 in parameters to force the ping if the ping was already sent.
|
||||
*/
|
||||
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
|
||||
@@ -63,7 +63,7 @@ class box_comptes extends ModeleBoxes
|
||||
$this->db = $db;
|
||||
|
||||
// disable module for such cases
|
||||
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
||||
$listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL'));
|
||||
if (!in_array('banque', $listofmodulesforexternal) && !empty($user->socid)) {
|
||||
$this->enabled = 0; // disabled for external users
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class box_members_by_tags extends ModeleBoxes
|
||||
$this->db = $db;
|
||||
|
||||
// disable module for such cases
|
||||
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
||||
$listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL'));
|
||||
if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) {
|
||||
$this->enabled = 0; // disabled for external users
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class box_members_by_type extends ModeleBoxes
|
||||
$this->db = $db;
|
||||
|
||||
// disable module for such cases
|
||||
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
||||
$listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL'));
|
||||
if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) {
|
||||
$this->enabled = 0; // disabled for external users
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class box_members_last_modified extends ModeleBoxes
|
||||
$this->db = $db;
|
||||
|
||||
// disable module for such cases
|
||||
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
||||
$listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL'));
|
||||
if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) {
|
||||
$this->enabled = 0; // disabled for external users
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class box_members_last_subscriptions extends ModeleBoxes
|
||||
$this->db = $db;
|
||||
|
||||
// disable module for such cases
|
||||
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
||||
$listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL'));
|
||||
if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) {
|
||||
$this->enabled = 0; // disabled for external users
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes
|
||||
$this->db = $db;
|
||||
|
||||
// disable module for such cases
|
||||
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
||||
$listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL'));
|
||||
if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) {
|
||||
$this->enabled = 0; // disabled for external users
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class box_produits_alerte_stock extends ModeleBoxes
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
||||
$listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL'));
|
||||
$tmpentry = array('enabled'=>((isModEnabled("product") || isModEnabled("service")) && isModEnabled('stock')), 'perms'=>!empty($user->rights->stock->lire), 'module'=>'product|service|stock');
|
||||
$showmode = isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal);
|
||||
$this->hidden = ($showmode != 1);
|
||||
|
||||
@@ -311,7 +311,7 @@ class CMailFile
|
||||
// Add auto copy to if not already in $to (Note: Adding bcc for specific modules are also done from pages)
|
||||
// For example MAIN_MAIL_AUTOCOPY_TO can be 'email@example.com, __USER_EMAIL__, ...'
|
||||
if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO')) {
|
||||
$listofemailstoadd = explode(',', $conf->global->MAIN_MAIL_AUTOCOPY_TO);
|
||||
$listofemailstoadd = explode(',', getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO'));
|
||||
foreach ($listofemailstoadd as $key => $val) {
|
||||
$emailtoadd = $listofemailstoadd[$key];
|
||||
if (trim($emailtoadd) == '__USER_EMAIL__') {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user