Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into addButtonForOveritedocTemplate
This commit is contained in:
commit
34e451ded6
1215 changed files with 45105 additions and 36525 deletions
|
|
@ -8,6 +8,8 @@ $finder = (new PhpCsFixer\Finder())
|
|||
'custom',
|
||||
'documents',
|
||||
'doctemplates',
|
||||
'vendor',
|
||||
'install/doctemplates',
|
||||
'htdocs/custom',
|
||||
'htdocs/includes',
|
||||
'htdocs/install/doctemplates',
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
/*
|
||||
|
|
@ -86,7 +89,7 @@ $resexec = (int) (empty($resexec) ? 0 : trim($resexec));
|
|||
*/
|
||||
|
||||
// Count lines of code of application
|
||||
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc . --exclude-dir=includes,custom';
|
||||
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc . --exclude-dir=htdocs/includes,htdocs/custom,htdocs/theme/common/fontawesome-5,htdocs/theme/common/octicons';
|
||||
print 'Execute SCC to count lines of code in project: '.$commandcheck."\n";
|
||||
$output_arrproj = array();
|
||||
$resexecproj = 0;
|
||||
|
|
@ -94,7 +97,7 @@ exec($commandcheck, $output_arrproj, $resexecproj);
|
|||
|
||||
|
||||
// Count lines of code of dependencies
|
||||
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc htdocs/includes';
|
||||
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc htdocs/includes htdocs/theme/common/fontawesome-5 htdocs/theme/common/octicons';
|
||||
print 'Execute SCC to count lines of code in dependencies: '.$commandcheck."\n";
|
||||
$output_arrdep = array();
|
||||
$resexecdep = 0;
|
||||
|
|
@ -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 {
|
||||
|
|
@ -238,6 +243,7 @@ th,td {
|
|||
}
|
||||
.seedetail {
|
||||
color: #000088;
|
||||
cursor: pointer;
|
||||
}
|
||||
.box {
|
||||
padding: 20px;
|
||||
|
|
@ -293,7 +299,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";
|
||||
|
|
@ -314,9 +320,9 @@ $html .= '</tr>';
|
|||
foreach (array('proj', 'dep') as $source) {
|
||||
$html .= '<tr class="trgroup" id="source'.$source.'">';
|
||||
if ($source == 'proj') {
|
||||
$html .= '<td>All files from project only';
|
||||
$html .= '<td>All files without dependencies';
|
||||
} elseif ($source == 'dep') {
|
||||
$html .= '<td>All files from dependencies';
|
||||
$html .= '<td>All files of dependencies only';
|
||||
}
|
||||
$html .= ' <span class="seedetail" data-source="'.$source.'">(See detail per file type...)</span>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Bytes']).'</td>';
|
||||
|
|
@ -372,19 +378,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');
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -294,6 +294,12 @@ class Members extends DolibarrApi
|
|||
|
||||
$member = new Adherent($this->db);
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$member->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$member->$field = $value;
|
||||
}
|
||||
if ($member->create(DolibarrApiAccess::$user) < 0) {
|
||||
|
|
@ -329,6 +335,12 @@ class Members extends DolibarrApi
|
|||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$member->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
// Process the status separately because it must be updated using
|
||||
// the validate(), resiliate() and exclude() methods of the class Adherent.
|
||||
if ($field == 'statut') {
|
||||
|
|
|
|||
|
|
@ -159,6 +159,12 @@ class MembersTypes extends DolibarrApi
|
|||
|
||||
$membertype = new AdherentType($this->db);
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$membertype->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$membertype->$field = $value;
|
||||
}
|
||||
if ($membertype->create(DolibarrApiAccess::$user) < 0) {
|
||||
|
|
@ -194,6 +200,12 @@ class MembersTypes extends DolibarrApi
|
|||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$membertype->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
// Process the status separately because it must be updated using
|
||||
// the validate(), resiliate() and exclude() methods of the class AdherentType.
|
||||
$membertype->$field = $value;
|
||||
|
|
|
|||
|
|
@ -156,6 +156,12 @@ class Subscriptions extends DolibarrApi
|
|||
|
||||
$subscription = new Subscription($this->db);
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$subscription->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$subscription->$field = $value;
|
||||
}
|
||||
if ($subscription->create(DolibarrApiAccess::$user) < 0) {
|
||||
|
|
@ -187,6 +193,12 @@ class Subscriptions extends DolibarrApi
|
|||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$subscription->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$subscription->$field = $value;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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'))) {
|
||||
|
|
|
|||
|
|
@ -460,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"');
|
||||
|
|
@ -768,7 +768,7 @@ 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>";
|
||||
|
||||
|
|
|
|||
|
|
@ -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> ';
|
||||
|
||||
|
|
|
|||
|
|
@ -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>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>';
|
||||
|
|
|
|||
|
|
@ -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'));
|
||||
|
|
|
|||
|
|
@ -78,18 +78,24 @@ class DolibarrApi
|
|||
* Display a short message an return a http code 200
|
||||
*
|
||||
* @param string $field Field name
|
||||
* @param string $value Value to check/clean
|
||||
* @param mixed $value Value to check/clean
|
||||
* @param Object $object Object
|
||||
* @return string Value cleaned
|
||||
*/
|
||||
protected function _checkValForAPI($field, $value, $object)
|
||||
{
|
||||
// phpcs:enable
|
||||
// TODO Use type detected in $object->fields
|
||||
if (in_array($field, array('note', 'note_private', 'note_public', 'desc', 'description'))) {
|
||||
return sanitizeVal($value, 'restricthtml');
|
||||
if (!is_array($value)) {
|
||||
// TODO Use type detected in $object->fields if $object known and we can
|
||||
if (in_array($field, array('note', 'note_private', 'note_public', 'desc', 'description'))) {
|
||||
return sanitizeVal($value, 'restricthtml');
|
||||
} else {
|
||||
return sanitizeVal($value, 'alphanohtml');
|
||||
}
|
||||
} else {
|
||||
return sanitizeVal($value, 'alphanohtml');
|
||||
// TODO Recall _checkValForAPI for each element of array
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,6 +203,12 @@ class Boms extends DolibarrApi
|
|||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$this->bom->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->bom->$field = $value;
|
||||
}
|
||||
|
||||
|
|
@ -241,6 +247,12 @@ class Boms extends DolibarrApi
|
|||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$this->bom->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->bom->$field = $value;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -204,6 +204,12 @@ class Categories extends DolibarrApi
|
|||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$this->category->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->category->$field = $value;
|
||||
}
|
||||
if ($this->category->create(DolibarrApiAccess::$user) < 0) {
|
||||
|
|
@ -238,6 +244,12 @@ class Categories extends DolibarrApi
|
|||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$this->category->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->category->$field = $value;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ $p2hour = GETPOST('p2hour', 'int');
|
|||
$p2min = GETPOST('p2min', 'int');
|
||||
|
||||
$addreminder = GETPOST('addreminder', 'alpha');
|
||||
$offsetvalue = GETPOST('offsetvalue', 'int');
|
||||
$offsetvalue = GETPOSTINT('offsetvalue');
|
||||
$offsetunit = GETPOST('offsetunittype_duration', 'aZ09');
|
||||
$remindertype = GETPOST('selectremindertype', 'aZ09');
|
||||
$modelmail = GETPOST('actioncommsendmodel_mail', 'int');
|
||||
|
|
@ -536,7 +536,7 @@ if (empty($reshook) && $action == 'add') {
|
|||
if ($addreminder == 'on') {
|
||||
$actionCommReminder = new ActionCommReminder($db);
|
||||
|
||||
$dateremind = dol_time_plus_duree($datep, -$offsetvalue, $offsetunit);
|
||||
$dateremind = dol_time_plus_duree($datep, -1 * $offsetvalue, $offsetunit);
|
||||
|
||||
$actionCommReminder->dateremind = $dateremind;
|
||||
$actionCommReminder->typeremind = $remindertype;
|
||||
|
|
@ -653,7 +653,7 @@ if (empty($reshook) && $action == 'add') {
|
|||
if ($addreminder == 'on') {
|
||||
$actionCommReminder = new ActionCommReminder($db);
|
||||
|
||||
$dateremind = dol_time_plus_duree($datep, -$offsetvalue, $offsetunit);
|
||||
$dateremind = dol_time_plus_duree($datep, -1 * $offsetvalue, $offsetunit);
|
||||
|
||||
$actionCommReminder->dateremind = $dateremind;
|
||||
$actionCommReminder->typeremind = $remindertype;
|
||||
|
|
@ -981,7 +981,7 @@ if (empty($reshook) && $action == 'update') {
|
|||
if ($addreminder == 'on' && $object->datep > dol_now()) {
|
||||
$actionCommReminder = new ActionCommReminder($db);
|
||||
|
||||
$dateremind = dol_time_plus_duree($datep, -$offsetvalue, $offsetunit);
|
||||
$dateremind = dol_time_plus_duree($datep, -1 * $offsetvalue, $offsetunit);
|
||||
|
||||
$actionCommReminder->dateremind = $dateremind;
|
||||
$actionCommReminder->typeremind = $remindertype;
|
||||
|
|
|
|||
|
|
@ -217,6 +217,12 @@ class AgendaEvents extends DolibarrApi
|
|||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$this->actioncomm->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->actioncomm->$field = $this->_checkValForAPI($field, $value, $this->actioncomm);
|
||||
}
|
||||
/*if (isset($request_data["lines"])) {
|
||||
|
|
@ -269,6 +275,11 @@ class AgendaEvents extends DolibarrApi
|
|||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$this->actioncomm->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->actioncomm->$field = $this->_checkValForAPI($field, $value, $this->actioncomm);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -266,6 +266,12 @@ class Proposals extends DolibarrApi
|
|||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$this->propal->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->propal->$field = $value;
|
||||
}
|
||||
/*if (isset($request_data["lines"])) {
|
||||
|
|
@ -698,6 +704,12 @@ class Proposals extends DolibarrApi
|
|||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$this->propal->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->propal->$field = $value;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -282,6 +282,12 @@ class Orders extends DolibarrApi
|
|||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$this->commande->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->commande->$field = $value;
|
||||
}
|
||||
/*if (isset($request_data["lines"])) {
|
||||
|
|
@ -652,6 +658,12 @@ class Orders extends DolibarrApi
|
|||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$this->commande->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->commande->$field = $value;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ if (GETPOST('save') && !$cancel && $user->hasRight('banque', 'modifier')) {
|
|||
if (price2num(GETPOST("addcredit")) > 0) {
|
||||
$amount = price2num(GETPOST("addcredit"));
|
||||
} else {
|
||||
$amount = - price2num(GETPOST("adddebit"));
|
||||
$amount = price2num(-1 * (float) price2num(GETPOST("adddebit")));
|
||||
}
|
||||
|
||||
$operation = GETPOST("operation", 'alpha');
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -158,6 +158,12 @@ class BankAccounts extends DolibarrApi
|
|||
|
||||
$account = new Account($this->db);
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$account->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$account->$field = $this->_checkValForAPI($field, $value, $account);
|
||||
}
|
||||
// Date of the initial balance (required to create an account).
|
||||
|
|
@ -333,6 +339,12 @@ class BankAccounts extends DolibarrApi
|
|||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$account->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$account->$field = $this->_checkValForAPI($field, $value, $account);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -302,6 +302,12 @@ class Invoices extends DolibarrApi
|
|||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$this->invoice->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->invoice->$field = $value;
|
||||
}
|
||||
if (!array_key_exists('date', $request_data)) {
|
||||
|
|
@ -623,6 +629,12 @@ class Invoices extends DolibarrApi
|
|||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$this->invoice->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->invoice->$field = $value;
|
||||
}
|
||||
|
||||
|
|
@ -1422,10 +1434,10 @@ class Invoices extends DolibarrApi
|
|||
// Clean parameters amount if payment is for a credit note
|
||||
if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
$resteapayer = price2num($resteapayer, 'MT');
|
||||
$amounts[$id] = -$resteapayer;
|
||||
$amounts[$id] = price2num(-1 * $resteapayer, 'MT');
|
||||
// Multicurrency
|
||||
$newvalue = price2num($this->invoice->multicurrency_total_ttc, 'MT');
|
||||
$multicurrency_amounts[$id] = -$newvalue;
|
||||
$multicurrency_amounts[$id] = price2num(-1 * $newvalue, 'MT');
|
||||
} else {
|
||||
$resteapayer = price2num($resteapayer, 'MT');
|
||||
$amounts[$id] = $resteapayer;
|
||||
|
|
@ -1568,7 +1580,7 @@ class Invoices extends DolibarrApi
|
|||
}
|
||||
|
||||
if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
$amount = -$amount;
|
||||
$amount = price2num(-1 * $amount, 'MT');
|
||||
}
|
||||
|
||||
if ($is_multicurrency) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
||||
|
|
@ -215,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
|
||||
|
|
@ -224,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 = '')
|
||||
|
|
@ -233,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);
|
||||
|
||||
|
||||
|
|
@ -243,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";
|
||||
|
|
@ -278,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) {
|
||||
/*
|
||||
|
|
@ -301,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)."'";
|
||||
|
|
@ -329,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");
|
||||
|
|
@ -449,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;
|
||||
|
|
@ -473,7 +475,7 @@ 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);
|
||||
|
|
@ -496,17 +498,21 @@ class BonPrelevement extends CommonObject
|
|||
$amounts = array();
|
||||
$amountsperthirdparty = array();
|
||||
|
||||
$facs = $this->getListInvoices(1);
|
||||
$facs = $this->getListInvoices(1, $type);
|
||||
if ($this->error) {
|
||||
$error++;
|
||||
}
|
||||
//var_dump($facs);exit;
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
|
@ -514,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;
|
||||
|
|
@ -530,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);
|
||||
}
|
||||
|
|
@ -543,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';
|
||||
|
|
@ -553,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)';
|
||||
|
|
@ -571,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;
|
||||
|
|
@ -600,8 +644,9 @@ class BonPrelevement extends CommonObject
|
|||
|
||||
// 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,12 +721,13 @@ 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 Array(Id of invoices, Amount to pay)
|
||||
* @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;
|
||||
|
||||
|
|
@ -686,12 +735,14 @@ class BonPrelevement extends CommonObject
|
|||
|
||||
dol_syslog(get_class($this)."::getListInvoices");
|
||||
|
||||
/*
|
||||
* Returns all invoices presented within same order
|
||||
*/
|
||||
// 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";
|
||||
}
|
||||
|
|
@ -707,7 +758,11 @@ class BonPrelevement extends CommonObject
|
|||
$sql .= " AND pb.entity = ".((int) $conf->entity);
|
||||
if ($amounts) {
|
||||
if ($this->type == 'bank-transfer') {
|
||||
$sql .= " GROUP BY p.fk_facture_fourn";
|
||||
if ($type == 'salary') {
|
||||
$sql .= " GROUP BY p.fk_salary";
|
||||
} else {
|
||||
$sql .= " GROUP BY p.fk_facture_fourn";
|
||||
}
|
||||
} else {
|
||||
$sql .= " GROUP BY p.fk_facture";
|
||||
}
|
||||
|
|
@ -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)
|
||||
|
|
@ -1235,15 +1290,6 @@ class BonPrelevement extends CommonObject
|
|||
// 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
|
||||
*
|
||||
|
|
@ -1261,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) {
|
||||
|
|
@ -2125,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;
|
||||
|
|
@ -2171,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;
|
||||
|
|
@ -2743,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;
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ 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) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ if (empty($reshook)) {
|
|||
|
||||
$amount = price2num(GETPOST("amount", 'alpha'));
|
||||
if ($refund == 1) {
|
||||
$amount = -$amount;
|
||||
$amount = price2num(-1 * $amount);
|
||||
}
|
||||
$object->amount = $amount;
|
||||
$object->label = GETPOST("label", 'alpha');
|
||||
|
|
|
|||
|
|
@ -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 = '';
|
||||
|
|
|
|||
|
|
@ -202,6 +202,12 @@ class Contracts extends DolibarrApi
|
|||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$this->contract->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->contract->$field = $value;
|
||||
}
|
||||
/*if (isset($request_data["lines"])) {
|
||||
|
|
@ -509,6 +515,12 @@ class Contracts extends DolibarrApi
|
|||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
|
||||
$this->contract->context['caller'] = $request_data['caller'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->contract->$field = $value;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ include '../../main.inc.php';
|
|||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
|
||||
|
||||
|
||||
$id = GETPOST('id', 'aZ09');
|
||||
$objecttype = GETPOST('objecttype', 'aZ09arobase'); // 'module' or 'myobject@mymodule', 'mymodule_myobject'
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue