forked from Wavyzz/dolibarr
Merge branch 'develop' into patch-7
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -66,3 +66,5 @@ doc/install.lock
|
||||
/build/phpstan/phpstan
|
||||
/build/phpstan/bootstrap_custom.php
|
||||
phpstan_custom.neon
|
||||
/.php-cs-fixer.cache
|
||||
/.php_cs.cache
|
||||
|
||||
@@ -1,24 +1,53 @@
|
||||
<?php
|
||||
|
||||
/* PHP 7.0 */
|
||||
$finder = (new PhpCsFixer\Finder())
|
||||
->in(__DIR__)
|
||||
->exclude([
|
||||
'core/includes',
|
||||
'custom',
|
||||
'documents',
|
||||
'doctemplates',
|
||||
'htdocs/custom',
|
||||
'htdocs/includes',
|
||||
'htdocs/install/doctemplates',
|
||||
])
|
||||
->notPath('vendor');
|
||||
|
||||
|
||||
/* PHP 7.4+ */
|
||||
/*
|
||||
$finder = (new PhpCsFixer\Finder())
|
||||
->in(__DIR__)
|
||||
->exclude([
|
||||
'custom',
|
||||
'documents',
|
||||
'htdocs/custom',
|
||||
'htdocs/includes',
|
||||
])
|
||||
->notPath([
|
||||
'vendor',
|
||||
])
|
||||
;
|
||||
]);
|
||||
*/
|
||||
|
||||
return (new PhpCsFixer\Config())
|
||||
->setRules([
|
||||
// Apply PSR-12 as per https://wiki.dolibarr.org/index.php?title=Langages_et_normes#PHP:~:text=utiliser%20est%20le-,PSR%2D12,-(https%3A//www
|
||||
// '@PSR12' => true, // Disabled for now to limit number of changes
|
||||
'@PSR12' => true, // Disabled for now to limit number of changes
|
||||
|
||||
// Minimum version Dolibarr v18.0.0
|
||||
'@PHP71Migration' => true,
|
||||
// Compatibility with min 7.1 is announced with Dolibarr18.0 but
|
||||
// app is still working with 7.0 so no reason to abandon compatiblity with this target for the moment.
|
||||
// So we use target PHP70 for the moment.
|
||||
'@PHP70Migration' => true,
|
||||
//'@PHP71Migration' => true,
|
||||
|
||||
//'strict_param' => true,
|
||||
//'array_syntax' => ['syntax' => 'short'],
|
||||
//'list_syntax' => false,
|
||||
//'visibility_required' => false,
|
||||
'array_syntax' => false,
|
||||
'ternary_to_null_coalescing' => false
|
||||
])
|
||||
->setFinder($finder)
|
||||
// TAB Indent violates PSR-12 "must" rule, but used in code
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
<?php
|
||||
$force_install_message='KeepDefaultValuesMamp';
|
||||
$force_install_main_data_root='/Applications/MAMP/dolibarr_documents';
|
||||
$force_install_type='mysqli';
|
||||
$force_install_dbserver='localhost';
|
||||
$force_install_port='8889';
|
||||
$force_install_database='dolibarr';
|
||||
$force_install_createdatabase='1';
|
||||
$force_install_databaselogin='dolibarrmysql';
|
||||
$force_install_databasepass='root';
|
||||
$force_install_createuser='1';
|
||||
$force_install_databaserootlogin='root';
|
||||
$force_install_databaserootpass='root';
|
||||
$force_install_dolibarrlogin='admin';
|
||||
$force_install_nophpinfo='1';
|
||||
$force_install_lockinstall='444';
|
||||
|
||||
$force_install_message = 'KeepDefaultValuesMamp';
|
||||
$force_install_main_data_root = '/Applications/MAMP/dolibarr_documents';
|
||||
$force_install_type = 'mysqli';
|
||||
$force_install_dbserver = 'localhost';
|
||||
$force_install_port = '8889';
|
||||
$force_install_database = 'dolibarr';
|
||||
$force_install_createdatabase = '1';
|
||||
$force_install_databaselogin = 'dolibarrmysql';
|
||||
$force_install_databasepass = 'root';
|
||||
$force_install_createuser = '1';
|
||||
$force_install_databaserootlogin = 'root';
|
||||
$force_install_databaserootpass = 'root';
|
||||
$force_install_dolibarrlogin = 'admin';
|
||||
$force_install_nophpinfo = '1';
|
||||
$force_install_lockinstall = '444';
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
* \brief This script create a xml checksum file
|
||||
*/
|
||||
|
||||
if (! defined('NOREQUIREDB')) {
|
||||
if (!defined('NOREQUIREDB')) {
|
||||
define('NOREQUIREDB', '1'); // Do not create database handler $db
|
||||
}
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path = dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
@@ -44,9 +44,9 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
|
||||
* Main
|
||||
*/
|
||||
|
||||
$includecustom=0;
|
||||
$includeconstants=array();
|
||||
$buildzip=0;
|
||||
$includecustom = 0;
|
||||
$includeconstants = array();
|
||||
$buildzip = 0;
|
||||
|
||||
if (empty($argv[1])) {
|
||||
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value] [buildzip=1]\n";
|
||||
@@ -55,7 +55,7 @@ if (empty($argv[1])) {
|
||||
}
|
||||
|
||||
|
||||
$i=0;
|
||||
$i = 0;
|
||||
$result = array();
|
||||
while ($i < $argc) {
|
||||
if (!empty($argv[$i])) {
|
||||
@@ -71,10 +71,10 @@ while ($i < $argc) {
|
||||
$includeconstants[$i] = $result["includeconstant"];
|
||||
}
|
||||
if (!empty($result["buildzip"])) {
|
||||
$buildzip=1;
|
||||
$buildzip = 1;
|
||||
}
|
||||
if (preg_match('/includeconstant=/', strval($argv[$i]))) {
|
||||
$tmp=explode(':', $result['includeconstant'], 3); // $includeconstant has been set with previous parse_str()
|
||||
$tmp = explode(':', $result['includeconstant'], 3); // $includeconstant has been set with previous parse_str()
|
||||
if (count($tmp) != 3) {
|
||||
print "Error: Bad parameter includeconstant=".$result['includeconstant'] ."\n";
|
||||
exit -1;
|
||||
@@ -93,16 +93,16 @@ if (empty($release)) {
|
||||
$savrelease = $release;
|
||||
|
||||
// If release is auto, we take current version
|
||||
$tmpver=explode('-', $release, 2);
|
||||
$tmpver = explode('-', $release, 2);
|
||||
if ($tmpver[0] == 'auto' || $tmpver[0] == 'autostable') {
|
||||
$release=DOL_VERSION;
|
||||
$release = DOL_VERSION;
|
||||
if ($tmpver[1] && $tmpver[0] == 'auto') {
|
||||
$release.='-'.$tmpver[1];
|
||||
$release .= '-'.$tmpver[1];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($includecustom)) {
|
||||
$tmpverbis=explode('-', $release, 2);
|
||||
$tmpverbis = explode('-', $release, 2);
|
||||
if (empty($tmpverbis[1]) || $tmpver[0] == 'autostable') {
|
||||
if (DOL_VERSION != $tmpverbis[0] && $savrelease != 'auto') {
|
||||
print 'Error: When parameter "includecustom" is not set and there is no suffix in release parameter, version declared into filefunc.in.php ('.DOL_VERSION.') must be exact same value than "release" parameter ('.$tmpverbis[0].')'."\n";
|
||||
@@ -110,7 +110,7 @@ if (empty($includecustom)) {
|
||||
exit -1;
|
||||
}
|
||||
} else {
|
||||
$tmpverter=explode('-', DOL_VERSION, 2);
|
||||
$tmpverter = explode('-', DOL_VERSION, 2);
|
||||
if ($tmpverter[0] != $tmpverbis[0]) {
|
||||
print 'Error: When parameter "includecustom" is not set, version declared into filefunc.in.php ('.DOL_VERSION.') must have value without prefix ('.$tmpverter[0].') that is exact same value than "release" parameter ('.$tmpverbis[0].')'."\n";
|
||||
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
|
||||
@@ -118,7 +118,7 @@ if (empty($includecustom)) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (! preg_match('/'.preg_quote(DOL_VERSION, '/').'-/', $release)) {
|
||||
if (!preg_match('/'.preg_quote(DOL_VERSION, '/').'-/', $release)) {
|
||||
print 'Error: When parameter "includecustom" is set, version declared into filefunc.inc.php ('.DOL_VERSION.') must be used with a suffix into "release" parameter (ex: '.DOL_VERSION.'-mydistrib).'."\n";
|
||||
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
|
||||
exit -1;
|
||||
@@ -137,13 +137,13 @@ foreach ($includeconstants as $countrycode => $tmp) {
|
||||
print "\n";
|
||||
|
||||
//$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml';
|
||||
$outputdir=dirname(dirname(__FILE__)).'/htdocs/install';
|
||||
$outputdir = dirname(dirname(__FILE__)).'/htdocs/install';
|
||||
print 'Delete current files '.$outputdir.'/filelist*.xml*'."\n";
|
||||
dol_delete_file($outputdir.'/filelist*.xml*', 0, 1, 1);
|
||||
|
||||
$checksumconcat=array();
|
||||
$checksumconcat = array();
|
||||
|
||||
$outputfile=$outputdir.'/filelist-'.$release.'.xml';
|
||||
$outputfile = $outputdir.'/filelist-'.$release.'.xml';
|
||||
$fp = fopen($outputfile, 'w');
|
||||
if (empty($fp)) {
|
||||
print 'Failed to open file '.$outputfile."\n";
|
||||
@@ -156,8 +156,8 @@ fputs($fp, '<checksum_list version="'.$release.'" date="'.dol_print_date(dol_now
|
||||
foreach ($includeconstants as $countrycode => $tmp) {
|
||||
fputs($fp, '<dolibarr_constants country="'.$countrycode.'">'."\n");
|
||||
foreach ($tmp as $constname => $constvalue) {
|
||||
$valueforchecksum=(empty($constvalue)?'0':$constvalue);
|
||||
$checksumconcat[]=$valueforchecksum;
|
||||
$valueforchecksum = (empty($constvalue) ? '0' : $constvalue);
|
||||
$checksumconcat[] = $valueforchecksum;
|
||||
fputs($fp, ' <constant name="'.$constname.'">'.$valueforchecksum.'</constant>'."\n");
|
||||
}
|
||||
fputs($fp, '</dolibarr_constants>'."\n");
|
||||
@@ -172,26 +172,26 @@ $files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom
|
||||
*/
|
||||
// Define qualified files (must be same than into generate_filelist_xml.php and in api_setup.class.php)
|
||||
$regextoinclude = '\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|bak|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
|
||||
$regextoexclude = '('.($includecustom?'':'custom|').'documents|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
|
||||
$regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
|
||||
$files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
|
||||
|
||||
$dir='';
|
||||
$needtoclose=0;
|
||||
$dir = '';
|
||||
$needtoclose = 0;
|
||||
foreach ($files as $filetmp) {
|
||||
$file = $filetmp['fullname'];
|
||||
//$newdir = str_replace(dirname(__FILE__).'/../htdocs', '', dirname($file));
|
||||
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
|
||||
if ($newdir!=$dir) {
|
||||
if ($newdir != $dir) {
|
||||
if ($needtoclose) {
|
||||
fputs($fp, ' </dir>'."\n");
|
||||
}
|
||||
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
|
||||
$dir = $newdir;
|
||||
$needtoclose=1;
|
||||
$needtoclose = 1;
|
||||
}
|
||||
if (filetype($file)=="file") {
|
||||
$md5=md5_file($file);
|
||||
$checksumconcat[]=$md5;
|
||||
if (filetype($file) == "file") {
|
||||
$md5 = md5_file($file);
|
||||
$checksumconcat[] = $md5;
|
||||
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
|
||||
}
|
||||
}
|
||||
@@ -205,7 +205,7 @@ fputs($fp, md5(join(',', $checksumconcat))."\n");
|
||||
fputs($fp, '</dolibarr_htdocs_dir_checksum>'."\n");
|
||||
|
||||
|
||||
$checksumconcat=array();
|
||||
$checksumconcat = array();
|
||||
|
||||
fputs($fp, '<dolibarr_script_dir version="'.$release.'">'."\n");
|
||||
|
||||
@@ -215,27 +215,27 @@ $iterator2 = new RecursiveIteratorIterator($dir_iterator2);
|
||||
// Need to ignore document custom etc. Note: this also ignore natively symbolic links.
|
||||
$files = new RegexIterator($iterator2, '#^(?:[A-Z]:)?(?:/(?!(?:custom|documents|conf|install))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
|
||||
*/
|
||||
$regextoinclude='\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$';
|
||||
$regextoexclude='(custom|documents|conf|install)$'; // Exclude dirs
|
||||
$regextoinclude = '\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$';
|
||||
$regextoexclude = '(custom|documents|conf|install)$'; // Exclude dirs
|
||||
$files = dol_dir_list(dirname(__FILE__).'/../scripts/', 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
|
||||
$dir='';
|
||||
$needtoclose=0;
|
||||
$dir = '';
|
||||
$needtoclose = 0;
|
||||
foreach ($files as $filetmp) {
|
||||
$file = $filetmp['fullname'];
|
||||
//$newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file));
|
||||
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
|
||||
$newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file));
|
||||
if ($newdir!=$dir) {
|
||||
if ($newdir != $dir) {
|
||||
if ($needtoclose) {
|
||||
fputs($fp, ' </dir>'."\n");
|
||||
}
|
||||
fputs($fp, ' <dir name="'.$newdir.'" >'."\n");
|
||||
$dir = $newdir;
|
||||
$needtoclose=1;
|
||||
$needtoclose = 1;
|
||||
}
|
||||
if (filetype($file)=="file") {
|
||||
$md5=md5_file($file);
|
||||
$checksumconcat[]=$md5;
|
||||
if (filetype($file) == "file") {
|
||||
$md5 = md5_file($file);
|
||||
$checksumconcat[] = $md5;
|
||||
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
<?php
|
||||
|
||||
// Defined some constants and load Dolibarr env to reduce PHPStan bootstrap that fails to load a lot of things.
|
||||
//define('DOL_DOCUMENT_ROOT', __DIR__ . '/../../htdocs');
|
||||
//define('DOL_DATA_ROOT', __DIR__ . '/../../documents');
|
||||
//define('DOL_URL_ROOT', '/');
|
||||
|
||||
// Load the main.inc.php file to have functions env defined
|
||||
if (! defined("NOLOGIN")) define("NOLOGIN", '1');
|
||||
if (! defined("NOHTTPSREDIRECT")) define("NOHTTPSREDIRECT", '1');
|
||||
if (!defined("NOLOGIN")) {
|
||||
define("NOLOGIN", '1');
|
||||
}
|
||||
if (!defined("NOHTTPSREDIRECT")) {
|
||||
define("NOHTTPSREDIRECT", '1');
|
||||
}
|
||||
global $conf, $langs, $user, $db;
|
||||
include_once __DIR__ . '/../../htdocs/main.inc.php';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
//
|
||||
// Take a look at conf.php.example file for an example of conf.php file
|
||||
// and explanations for all possibles parameters.
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path = dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
@@ -34,8 +34,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
}
|
||||
|
||||
// Global variables
|
||||
$version='1.7';
|
||||
$error=0;
|
||||
$version = '1.7';
|
||||
$error = 0;
|
||||
|
||||
|
||||
// -------------------- START OF YOUR CODE HERE --------------------
|
||||
@@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language
|
||||
@set_time_limit(0);
|
||||
|
||||
// Load user and its permissions
|
||||
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (! $result > 0) {
|
||||
$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (!$result > 0) {
|
||||
dol_print_error('', $user->error);
|
||||
exit;
|
||||
}
|
||||
@@ -74,20 +74,20 @@ $obj->note_public = 'A public comment';
|
||||
$obj->note_private = 'A private comment';
|
||||
$obj->cond_reglement_id = 1;
|
||||
|
||||
$line1=new FactureLigne($db);
|
||||
$line1->tva_tx=10.0;
|
||||
$line1->remise_percent=0;
|
||||
$line1->qty=1;
|
||||
$line1->total_ht=100;
|
||||
$line1->total_tva=10;
|
||||
$line1->total_ttc=110;
|
||||
$obj->lines[]=$line1;
|
||||
$line1 = new FactureLigne($db);
|
||||
$line1->tva_tx = 10.0;
|
||||
$line1->remise_percent = 0;
|
||||
$line1->qty = 1;
|
||||
$line1->total_ht = 100;
|
||||
$line1->total_tva = 10;
|
||||
$line1->total_ttc = 110;
|
||||
$obj->lines[] = $line1;
|
||||
|
||||
// Create invoice
|
||||
$idobject=$obj->create($user);
|
||||
$idobject = $obj->create($user);
|
||||
if ($idobject > 0) {
|
||||
// Change status to validated
|
||||
$result=$obj->validate($user);
|
||||
$result = $obj->validate($user);
|
||||
if ($result > 0) {
|
||||
print "OK Object created with id ".$idobject."\n";
|
||||
} else {
|
||||
@@ -102,7 +102,7 @@ if ($idobject > 0) {
|
||||
|
||||
// -------------------- END OF YOUR CODE --------------------
|
||||
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
print '--- end ok'."\n";
|
||||
} else {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path = dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
@@ -34,8 +34,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
}
|
||||
|
||||
// Global variables
|
||||
$version='1.11';
|
||||
$error=0;
|
||||
$version = '1.11';
|
||||
$error = 0;
|
||||
|
||||
|
||||
// -------------------- START OF YOUR CODE HERE --------------------
|
||||
@@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language
|
||||
@set_time_limit(0);
|
||||
|
||||
// Load user and its permissions
|
||||
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (! $result > 0) {
|
||||
$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (!$result > 0) {
|
||||
dol_print_error('', $user->error);
|
||||
exit;
|
||||
}
|
||||
@@ -75,17 +75,17 @@ $com->note_private = 'A private comment';
|
||||
$com->source = 1;
|
||||
$com->remise_percent = 0;
|
||||
|
||||
$orderline1=new OrderLine($db);
|
||||
$orderline1->tva_tx=10.0;
|
||||
$orderline1->remise_percent=0;
|
||||
$orderline1->qty=1;
|
||||
$com->lines[]=$orderline1;
|
||||
$orderline1 = new OrderLine($db);
|
||||
$orderline1->tva_tx = 10.0;
|
||||
$orderline1->remise_percent = 0;
|
||||
$orderline1->qty = 1;
|
||||
$com->lines[] = $orderline1;
|
||||
|
||||
// Create order
|
||||
$idobject=$com->create($user);
|
||||
$idobject = $com->create($user);
|
||||
if ($idobject > 0) {
|
||||
// Change status to validated
|
||||
$result=$com->valid($user);
|
||||
$result = $com->valid($user);
|
||||
if ($result > 0) {
|
||||
print "OK Object created with id ".$idobject."\n";
|
||||
} else {
|
||||
@@ -100,7 +100,7 @@ if ($idobject > 0) {
|
||||
|
||||
// -------------------- END OF YOUR CODE --------------------
|
||||
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
print '--- end ok'."\n";
|
||||
} else {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path = dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
@@ -34,8 +34,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
}
|
||||
|
||||
// Global variables
|
||||
$version='1.10';
|
||||
$error=0;
|
||||
$version = '1.10';
|
||||
$error = 0;
|
||||
|
||||
|
||||
// -------------------- START OF YOUR CODE HERE --------------------
|
||||
@@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language
|
||||
@set_time_limit(0);
|
||||
|
||||
// Load user and its permissions
|
||||
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (! $result > 0) {
|
||||
$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (!$result > 0) {
|
||||
dol_print_error('', $user->error);
|
||||
exit;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ $db->begin();
|
||||
require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php";
|
||||
|
||||
// Create instance of object
|
||||
$myproduct=new Product($db);
|
||||
$myproduct = new Product($db);
|
||||
|
||||
// Definition of product instance properties
|
||||
$myproduct->ref = '1234';
|
||||
@@ -91,7 +91,7 @@ if ($idobject > 0) {
|
||||
|
||||
// -------------------- END OF YOUR CODE --------------------
|
||||
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
print '--- end ok'."\n";
|
||||
} else {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path = dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
@@ -34,8 +34,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
}
|
||||
|
||||
// Global variables
|
||||
$version='1.7';
|
||||
$error=0;
|
||||
$version = '1.7';
|
||||
$error = 0;
|
||||
|
||||
|
||||
// -------------------- START OF YOUR CODE HERE --------------------
|
||||
@@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language
|
||||
@set_time_limit(0);
|
||||
|
||||
// Load user and its permissions
|
||||
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (! $result > 0) {
|
||||
$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (!$result > 0) {
|
||||
dol_print_error('', $user->error);
|
||||
exit;
|
||||
}
|
||||
@@ -71,10 +71,10 @@ $obj->login = 'ABCDEF';
|
||||
$obj->nom = 'ABCDEF';
|
||||
|
||||
// Create user
|
||||
$idobject=$obj->create($user);
|
||||
$idobject = $obj->create($user);
|
||||
if ($idobject > 0) {
|
||||
// Change status to validated
|
||||
$result=$obj->setStatut(1);
|
||||
$result = $obj->setStatut(1);
|
||||
if ($result > 0) {
|
||||
print "OK Object created with id ".$idobject."\n";
|
||||
} else {
|
||||
@@ -82,7 +82,7 @@ if ($idobject > 0) {
|
||||
dol_print_error($db, $obj->error);
|
||||
}
|
||||
} elseif ($obj->error == 'ErrorLoginAlreadyExists') {
|
||||
print "User with login ".$obj->login." already exists\n";
|
||||
print "User with login ".$obj->login." already exists\n";
|
||||
} else {
|
||||
$error++;
|
||||
dol_print_error($db, $obj->error);
|
||||
@@ -91,7 +91,7 @@ if ($idobject > 0) {
|
||||
|
||||
// -------------------- END OF YOUR CODE --------------------
|
||||
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
print '--- end ok'."\n";
|
||||
} else {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path = dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
@@ -34,8 +34,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
}
|
||||
|
||||
// Global variables
|
||||
$version='1.7';
|
||||
$error=0;
|
||||
$version = '1.7';
|
||||
$error = 0;
|
||||
|
||||
|
||||
// -------------------- START OF YOUR CODE HERE --------------------
|
||||
@@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language
|
||||
@set_time_limit(0);
|
||||
|
||||
// Load user and its permissions
|
||||
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (! $result > 0) {
|
||||
$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (!$result > 0) {
|
||||
dol_print_error('', $user->error);
|
||||
exit;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ $user->getrights();
|
||||
|
||||
|
||||
print "***** ".$script_file." (".$version.") *****\n";
|
||||
if (! isset($argv[1])) { // Check parameters
|
||||
if (!isset($argv[1])) { // Check parameters
|
||||
print "Usage: ".$script_file." id_thirdparty ...\n";
|
||||
exit;
|
||||
}
|
||||
@@ -72,9 +72,9 @@ require_once DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php";
|
||||
|
||||
// Create contract object
|
||||
$obj = new Contrat($db);
|
||||
$obj->socid=$argv[1];
|
||||
$obj->socid = $argv[1];
|
||||
|
||||
$listofcontractsforcompany=$obj->getListOfContracts('all');
|
||||
$listofcontractsforcompany = $obj->getListOfContracts('all');
|
||||
|
||||
print $listofcontractsforcompany;
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
|
||||
|
||||
define('GEN_NUMBER_FACTURE', $argv[1] ?? 1);
|
||||
$year = 2016;
|
||||
$dates = array (mktime(12, 0, 0, 1, 3, $year),
|
||||
$dates = array(mktime(12, 0, 0, 1, 3, $year),
|
||||
mktime(12, 0, 0, 1, 9, $year),
|
||||
mktime(12, 0, 0, 2, 13, $year),
|
||||
mktime(12, 0, 0, 2, 23, $year),
|
||||
@@ -168,7 +168,8 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0) {
|
||||
|
||||
$result=$object->validate($fuser);
|
||||
if ($result) {
|
||||
print " OK with ref ".$object->ref."\n";;
|
||||
print " OK with ref ".$object->ref."\n";
|
||||
;
|
||||
} else {
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ require_once DOL_DOCUMENT_ROOT."/commande/class/commande.class.php";
|
||||
|
||||
define('GEN_NUMBER_COMMANDE', $argv[1] ?? 10);
|
||||
$year = 2016;
|
||||
$dates = array (mktime(12, 0, 0, 1, 3, $year),
|
||||
$dates = array(mktime(12, 0, 0, 1, 3, $year),
|
||||
mktime(12, 0, 0, 1, 9, $year),
|
||||
mktime(12, 0, 0, 2, 13, $year),
|
||||
mktime(12, 0, 0, 2, 23, $year),
|
||||
|
||||
@@ -64,18 +64,24 @@ $user->getrights();
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql); $i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql); $productsid[$i] = $row[0]; $i++;
|
||||
$row = $db->fetch_row($resql);
|
||||
$productsid[$i] = $row[0];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql); $i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql); $societesid[$i] = $row[0]; $i++;
|
||||
$row = $db->fetch_row($resql);
|
||||
$societesid[$i] = $row[0];
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print "err";
|
||||
@@ -84,9 +90,12 @@ if ($resql) {
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $commandesid = array();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql); $i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql); $commandesid[$i] = $row[0]; $i++;
|
||||
$row = $db->fetch_row($resql);
|
||||
$commandesid[$i] = $row[0];
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print "err";
|
||||
@@ -99,7 +108,7 @@ for ($s = 0; $s < GEN_NUMBER_PRODUIT; $s++) {
|
||||
$produit = new Product($db);
|
||||
$produit->type = mt_rand(0, 1);
|
||||
$produit->status = 1;
|
||||
$produit->ref = ($produit->type?'S':'P').time().$s;
|
||||
$produit->ref = ($produit->type ? 'S' : 'P').time().$s;
|
||||
$produit->label = 'Label '.time().$s;
|
||||
$produit->description = 'Description '.time().$s;
|
||||
$produit->price = mt_rand(1, 999.99);
|
||||
|
||||
@@ -49,7 +49,7 @@ require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
|
||||
|
||||
define('GEN_NUMBER_PROPAL', $argv[1] ?? 10);
|
||||
$year = 2016;
|
||||
$dates = array (mktime(12, 0, 0, 1, 3, $year),
|
||||
$dates = array(mktime(12, 0, 0, 1, 3, $year),
|
||||
mktime(12, 0, 0, 1, 9, $year),
|
||||
mktime(12, 0, 0, 2, 13, $year),
|
||||
mktime(12, 0, 0, 2, 23, $year),
|
||||
|
||||
@@ -67,7 +67,8 @@ $user->getrights();
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql); $i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql);
|
||||
$productsid[$i] = $row[0];
|
||||
@@ -78,7 +79,8 @@ if ($resql) {
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql); $i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql);
|
||||
$societesid[$i] = $row[0];
|
||||
@@ -91,7 +93,8 @@ if ($resql) {
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $commandesid = array();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql); $i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql);
|
||||
$commandesid[$i] = $row[0];
|
||||
@@ -117,7 +120,8 @@ for ($s = 0; $s < GEN_NUMBER_SOCIETE; $s++) {
|
||||
$soc->country_id=1;
|
||||
$soc->country_code='FR';
|
||||
// Un client sur 3 a une remise de 5%
|
||||
$user_remise=mt_rand(1, 3); if ($user_remise==3) {
|
||||
$user_remise=mt_rand(1, 3);
|
||||
if ($user_remise==3) {
|
||||
$soc->remise_percent=5;
|
||||
}
|
||||
print "> client=".$soc->client.", fournisseur=".$soc->fournisseur.", remise=".$soc->remise_percent."\n";
|
||||
|
||||
@@ -62,9 +62,9 @@ dol_syslog($script_file." launched with arg ".implode(',', $argv));
|
||||
$mode = $argv[1];
|
||||
$filepath = $argv[2];
|
||||
$filepatherr = $filepath.'.err';
|
||||
$defaultlang = empty($argv[3])?'en_US':$argv[3];
|
||||
$startlinenb = empty($argv[4])?1:$argv[4];
|
||||
$endlinenb = empty($argv[5])?0:$argv[5];
|
||||
$defaultlang = empty($argv[3]) ? 'en_US' : $argv[3];
|
||||
$startlinenb = empty($argv[4]) ? 1 : $argv[4];
|
||||
$endlinenb = empty($argv[5]) ? 0 : $argv[5];
|
||||
|
||||
if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) || empty($filepath)) {
|
||||
print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [defaultlang] [startlinenb] [endlinenb]\n";
|
||||
|
||||
@@ -63,8 +63,8 @@ $mode = $argv[1];
|
||||
$filepath = $argv[2];
|
||||
$filepatherr = $filepath.'.err';
|
||||
//$defaultlang = empty($argv[3])?'en_US':$argv[3];
|
||||
$startlinenb = empty($argv[3])?1:$argv[3];
|
||||
$endlinenb = empty($argv[4])?0:$argv[4];
|
||||
$startlinenb = empty($argv[3]) ? 1 : $argv[3];
|
||||
$endlinenb = empty($argv[4]) ? 0 : $argv[4];
|
||||
|
||||
if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) || empty($filepath)) {
|
||||
print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n";
|
||||
@@ -128,8 +128,8 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
||||
$object->client = $fields[7];
|
||||
$object->fournisseur = $fields[8];
|
||||
|
||||
$object->name = $fields[13]?trim($fields[13]):$fields[0];
|
||||
$object->name_alias = $fields[0]!=$fields[13]?trim($fields[0]):'';
|
||||
$object->name = $fields[13] ? trim($fields[13]) : $fields[0];
|
||||
$object->name_alias = $fields[0]!=$fields[13] ? trim($fields[0]) : '';
|
||||
|
||||
$object->address = trim($fields[14]);
|
||||
$object->zip = trim($fields[15]);
|
||||
|
||||
@@ -63,8 +63,8 @@ $mode = $argv[1];
|
||||
$filepath = $argv[2];
|
||||
$filepatherr = $filepath.'.err';
|
||||
//$defaultlang = empty($argv[3])?'en_US':$argv[3];
|
||||
$startlinenb = empty($argv[3])?1:$argv[3];
|
||||
$endlinenb = empty($argv[4])?0:$argv[4];
|
||||
$startlinenb = empty($argv[3]) ? 1 : $argv[3];
|
||||
$endlinenb = empty($argv[4]) ? 0 : $argv[4];
|
||||
|
||||
if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) || empty($filepath)) {
|
||||
print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n";
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path = dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
@@ -30,39 +30,39 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
}
|
||||
|
||||
// Global variables
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$sourceserver=isset($argv[1])?$argv[1]:''; // user@server:/src/file
|
||||
$password=isset($argv[2])?$argv[2]:'';
|
||||
$dataserver=isset($argv[3])?$argv[3]:'';
|
||||
$database=isset($argv[4])?$argv[4]:'';
|
||||
$loginbase=isset($argv[5])?$argv[5]:'';
|
||||
$passwordbase=isset($argv[6])?$argv[6]:'';
|
||||
$sourceserver = isset($argv[1]) ? $argv[1] : ''; // user@server:/src/file
|
||||
$password = isset($argv[2]) ? $argv[2] : '';
|
||||
$dataserver = isset($argv[3]) ? $argv[3] : '';
|
||||
$database = isset($argv[4]) ? $argv[4] : '';
|
||||
$loginbase = isset($argv[5]) ? $argv[5] : '';
|
||||
$passwordbase = isset($argv[6]) ? $argv[6] : '';
|
||||
|
||||
// Include Dolibarr environment
|
||||
$res=0;
|
||||
if (! $res && file_exists($path."../../master.inc.php")) {
|
||||
$res=@include $path."../../master.inc.php";
|
||||
$res = 0;
|
||||
if (!$res && file_exists($path."../../master.inc.php")) {
|
||||
$res = @include $path."../../master.inc.php";
|
||||
}
|
||||
if (! $res && file_exists($path."../../htdocs/master.inc.php")) {
|
||||
$res=@include $path."../../htdocs/master.inc.php";
|
||||
if (!$res && file_exists($path."../../htdocs/master.inc.php")) {
|
||||
$res = @include $path."../../htdocs/master.inc.php";
|
||||
}
|
||||
if (! $res && file_exists("../master.inc.php")) {
|
||||
$res=@include "../master.inc.php";
|
||||
if (!$res && file_exists("../master.inc.php")) {
|
||||
$res = @include "../master.inc.php";
|
||||
}
|
||||
if (! $res && file_exists("../../master.inc.php")) {
|
||||
$res=@include "../../master.inc.php";
|
||||
if (!$res && file_exists("../../master.inc.php")) {
|
||||
$res = @include "../../master.inc.php";
|
||||
}
|
||||
if (! $res && file_exists("../../../master.inc.php")) {
|
||||
$res=@include "../../../master.inc.php";
|
||||
if (!$res && file_exists("../../../master.inc.php")) {
|
||||
$res = @include "../../../master.inc.php";
|
||||
}
|
||||
if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
|
||||
$res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
|
||||
if (!$res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
|
||||
$res = @include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
|
||||
}
|
||||
if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
|
||||
$res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
|
||||
if (!$res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
|
||||
$res = @include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
|
||||
}
|
||||
if (! $res) {
|
||||
if (!$res) {
|
||||
die("Failed to include master.inc.php file\n");
|
||||
}
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
@@ -72,13 +72,13 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
* Main
|
||||
*/
|
||||
|
||||
$login='';
|
||||
$server='';
|
||||
$login = '';
|
||||
$server = '';
|
||||
if (preg_match('/^(.*)@(.*):(.*)$/', $sourceserver, $reg)) {
|
||||
$login=$reg[1];
|
||||
$server=$reg[2];
|
||||
$sourcefile=$reg[3];
|
||||
$targetfile=basename($sourcefile);
|
||||
$login = $reg[1];
|
||||
$server = $reg[2];
|
||||
$sourcefile = $reg[3];
|
||||
$targetfile = basename($sourcefile);
|
||||
}
|
||||
if (empty($sourceserver) || empty($server) || empty($login) || empty($sourcefile) || empty($password) || empty($database) || empty($loginbase) || empty($passwordbase)) {
|
||||
print "Usage: $script_file login@server:/src/file.(sql|gz|bz2) passssh databaseserver databasename loginbase passbase\n";
|
||||
@@ -88,22 +88,23 @@ if (empty($sourceserver) || empty($server) || empty($login) || empty($sourcefile
|
||||
}
|
||||
|
||||
|
||||
$targetdir='/tmp';
|
||||
$targetdir = '/tmp';
|
||||
print "Get dump file from server ".$server.", path ".$sourcefile.", connect with login ".$login." loaded into localhost\n";
|
||||
|
||||
$sftpconnectstring=$sourceserver;
|
||||
$sftpconnectstring = $sourceserver;
|
||||
print 'SFTP connect string : '.$sftpconnectstring."\n";
|
||||
//print 'SFTP password '.$password."\n";
|
||||
|
||||
|
||||
// SFTP connect
|
||||
if (! function_exists("ssh2_connect")) {
|
||||
dol_print_error('', 'ssh2_connect function does not exists'); exit(1);
|
||||
if (!function_exists("ssh2_connect")) {
|
||||
dol_print_error('', 'ssh2_connect function does not exists');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$connection = ssh2_connect($server, 22);
|
||||
if ($connection) {
|
||||
if (! @ssh2_auth_password($connection, $login, $password)) {
|
||||
if (!@ssh2_auth_password($connection, $login, $password)) {
|
||||
dol_syslog("Could not authenticate with username ".$login." . and password ".preg_replace('/./', '*', $password), LOG_ERR);
|
||||
exit(-5);
|
||||
} else {
|
||||
@@ -121,16 +122,16 @@ if ($connection) {
|
||||
print 'Get file '.$sourcefile.' into '.$targetdir.$targetfile."\n";
|
||||
ssh2_scp_recv($connection, $sourcefile, $targetdir.$targetfile);
|
||||
|
||||
$fullcommand="cat ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
|
||||
$fullcommand = "cat ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
|
||||
if (preg_match('/\.bz2$/', $targetfile)) {
|
||||
$fullcommand="bzip2 -c -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
|
||||
$fullcommand = "bzip2 -c -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
|
||||
}
|
||||
if (preg_match('/\.gz$/', $targetfile)) {
|
||||
$fullcommand="gzip -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
|
||||
$fullcommand = "gzip -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
|
||||
}
|
||||
print "Load dump with ".$fullcommand."\n";
|
||||
$output=array();
|
||||
$return_var=0;
|
||||
$output = array();
|
||||
$return_var = 0;
|
||||
print strftime("%Y%m%d-%H%M%S").' '.$fullcommand."\n";
|
||||
exec($fullcommand, $output, $return_var);
|
||||
foreach ($output as $line) {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path = dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
@@ -30,34 +30,34 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
}
|
||||
|
||||
// Global variables
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$confirm=isset($argv[1])?$argv[1]:'';
|
||||
$confirm = isset($argv[1]) ? $argv[1] : '';
|
||||
|
||||
// Include Dolibarr environment
|
||||
$res=0;
|
||||
if (! $res && file_exists($path."../../master.inc.php")) {
|
||||
$res=@include $path."../../master.inc.php";
|
||||
$res = 0;
|
||||
if (!$res && file_exists($path."../../master.inc.php")) {
|
||||
$res = @include $path."../../master.inc.php";
|
||||
}
|
||||
if (! $res && file_exists($path."../../htdocs/master.inc.php")) {
|
||||
$res=@include $path."../../htdocs/master.inc.php";
|
||||
if (!$res && file_exists($path."../../htdocs/master.inc.php")) {
|
||||
$res = @include $path."../../htdocs/master.inc.php";
|
||||
}
|
||||
if (! $res && file_exists("../master.inc.php")) {
|
||||
$res=@include "../master.inc.php";
|
||||
if (!$res && file_exists("../master.inc.php")) {
|
||||
$res = @include "../master.inc.php";
|
||||
}
|
||||
if (! $res && file_exists("../../master.inc.php")) {
|
||||
$res=@include "../../master.inc.php";
|
||||
if (!$res && file_exists("../../master.inc.php")) {
|
||||
$res = @include "../../master.inc.php";
|
||||
}
|
||||
if (! $res && file_exists("../../../master.inc.php")) {
|
||||
$res=@include "../../../master.inc.php";
|
||||
if (!$res && file_exists("../../../master.inc.php")) {
|
||||
$res = @include "../../../master.inc.php";
|
||||
}
|
||||
if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
|
||||
$res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
|
||||
if (!$res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
|
||||
$res = @include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
|
||||
}
|
||||
if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
|
||||
$res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
|
||||
if (!$res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
|
||||
$res = @include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
|
||||
}
|
||||
if (! $res) {
|
||||
if (!$res) {
|
||||
die("Failed to include master.inc.php file\n");
|
||||
}
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
@@ -76,56 +76,56 @@ if (empty($confirm)) {
|
||||
}
|
||||
|
||||
|
||||
$tmp=dol_getdate(dol_now());
|
||||
$tmp = dol_getdate(dol_now());
|
||||
|
||||
|
||||
$tables=array(
|
||||
'propal'=>array(0=>'datep', 1=>'fin_validite', 2=>'date_valid', 3=>'date_cloture'),
|
||||
'commande'=>array(0=>'date_commande', 1=>'date_valid', 2=>'date_cloture'),
|
||||
'facture'=>array(0=>'datec', 1=>'datef', 2=>'date_valid', 3=>'date_lim_reglement'),
|
||||
'paiement'=>array(0=>'datep'),
|
||||
'bank'=>array(0=>'datev', 1=>'dateo'),
|
||||
'commande_fournisseur'=>array(0=>'date_commande', 1=>'date_valid', 3=>'date_creation', 4=>'date_approve', 5=>'date_approve2', 6=>'date_livraison'),
|
||||
'supplier_proposal'=>array(0=>'datec', 1=>'date_valid', 2=>'date_cloture'),
|
||||
'expensereport'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 4=>'date_approve', 5=>'date_refuse', 6=>'date_cancel'),
|
||||
'holiday'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 5=>'date_refuse', 6=>'date_cancel'),
|
||||
'ticket'=>array(0=>'datec', 1=>'date_read', 2=>'date_close')
|
||||
$tables = array(
|
||||
'propal' => array(0 => 'datep', 1 => 'fin_validite', 2 => 'date_valid', 3 => 'date_cloture'),
|
||||
'commande' => array(0 => 'date_commande', 1 => 'date_valid', 2 => 'date_cloture'),
|
||||
'facture' => array(0 => 'datec', 1 => 'datef', 2 => 'date_valid', 3 => 'date_lim_reglement'),
|
||||
'paiement' => array(0 => 'datep'),
|
||||
'bank' => array(0 => 'datev', 1 => 'dateo'),
|
||||
'commande_fournisseur' => array(0 => 'date_commande', 1 => 'date_valid', 3 => 'date_creation', 4 => 'date_approve', 5 => 'date_approve2', 6 => 'date_livraison'),
|
||||
'supplier_proposal' => array(0 => 'datec', 1 => 'date_valid', 2 => 'date_cloture'),
|
||||
'expensereport' => array(0 => 'date_debut', 1 => 'date_fin', 2 => 'date_create', 3 => 'date_valid', 4 => 'date_approve', 5 => 'date_refuse', 6 => 'date_cancel'),
|
||||
'holiday' => array(0 => 'date_debut', 1 => 'date_fin', 2 => 'date_create', 3 => 'date_valid', 5 => 'date_refuse', 6 => 'date_cancel'),
|
||||
'ticket' => array(0 => 'datec', 1 => 'date_read', 2 => 'date_close')
|
||||
);
|
||||
|
||||
$year=2010;
|
||||
$currentyear=$tmp['year'];
|
||||
$year = 2010;
|
||||
$currentyear = $tmp['year'];
|
||||
while ($year <= $currentyear) {
|
||||
//$year=2021;
|
||||
$delta1=($currentyear - $year);
|
||||
$delta2=($currentyear - $year - 1);
|
||||
$delta1 = ($currentyear - $year);
|
||||
$delta2 = ($currentyear - $year - 1);
|
||||
//$delta=-1;
|
||||
|
||||
if ($delta1) {
|
||||
foreach ($tables as $tablekey => $tableval) {
|
||||
print "Correct ".$tablekey." for year ".$year." and move them to current year ".$currentyear." ";
|
||||
$sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." < DATE_ADD(NOW(), INTERVAL -1 YEAR)";
|
||||
$sql = "select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." < DATE_ADD(NOW(), INTERVAL -1 YEAR)";
|
||||
//$sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." > NOW()";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i=0;
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj=$db->fetch_object($resql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
print ".";
|
||||
$sql2="UPDATE ".MAIN_DB_PREFIX.$tablekey." set ";
|
||||
$j=0;
|
||||
$sql2 = "UPDATE ".MAIN_DB_PREFIX.$tablekey." set ";
|
||||
$j = 0;
|
||||
foreach ($tableval as $field) {
|
||||
if ($j) {
|
||||
$sql2.=", ";
|
||||
$sql2 .= ", ";
|
||||
}
|
||||
$sql2.= $field." = ".$db->ifsql("DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR) > NOW()", "DATE_ADD(".$field.", INTERVAL ".$delta2." YEAR)", "DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR)");
|
||||
$sql2 .= $field." = ".$db->ifsql("DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR) > NOW()", "DATE_ADD(".$field.", INTERVAL ".$delta2." YEAR)", "DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR)");
|
||||
$j++;
|
||||
}
|
||||
$sql2.=" WHERE rowid = ".$obj->rowid;
|
||||
$sql2 .= " WHERE rowid = ".$obj->rowid;
|
||||
//print $sql2."\n";
|
||||
$resql2 = $db->query($sql2);
|
||||
if (! $resql2) {
|
||||
if (!$resql2) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
1
dev/tools/.gitignore
vendored
Normal file
1
dev/tools/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/vendor/
|
||||
@@ -34,7 +34,7 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
exit();
|
||||
}
|
||||
|
||||
error_reporting(E_ALL & ~ E_DEPRECATED);
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
define('PRODUCT', "apstats");
|
||||
define('VERSION', "1.0");
|
||||
|
||||
@@ -51,7 +51,7 @@ $outputpath = $argv[1];
|
||||
$outputdir = dirname($outputpath);
|
||||
$outputfile = basename($outputpath);
|
||||
|
||||
if (! is_dir($outputdir)) {
|
||||
if (!is_dir($outputdir)) {
|
||||
print 'Error: dir '.$outputdir.' does not exists or is not writable'."\n";
|
||||
exit(1);
|
||||
}
|
||||
@@ -111,8 +111,8 @@ exec($commandcheck, $output_arrtd, $resexectd);
|
||||
$arrayoflineofcode = array();
|
||||
$arraycocomo = array();
|
||||
$arrayofmetrics = array(
|
||||
'proj'=>array('Bytes'=>0, 'Files'=>0, 'Lines'=>0, 'Blanks'=>0, 'Comments'=>0, 'Code'=>0, 'Complexity'=>0),
|
||||
'dep'=>array('Bytes'=>0, 'Files'=>0, 'Lines'=>0, 'Blanks'=>0, 'Comments'=>0, 'Code'=>0, 'Complexity'=>0)
|
||||
'proj' => array('Bytes' => 0, 'Files' => 0, 'Lines' => 0, 'Blanks' => 0, 'Comments' => 0, 'Code' => 0, 'Complexity' => 0),
|
||||
'dep' => array('Bytes' => 0, 'Files' => 0, 'Lines' => 0, 'Blanks' => 0, 'Comments' => 0, 'Code' => 0, 'Complexity' => 0)
|
||||
);
|
||||
|
||||
// Analyse $output_arrproj
|
||||
|
||||
@@ -37,14 +37,14 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
exit();
|
||||
}
|
||||
|
||||
error_reporting(E_ALL & ~ E_DEPRECATED);
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
define('PRODUCT', "pg2mysql");
|
||||
define('VERSION', "2.0");
|
||||
|
||||
// this is the default, it can be overridden here, or specified as the third parameter on the command line
|
||||
$config['engine'] = "InnoDB";
|
||||
|
||||
if (! ($argv[1] && $argv[2])) {
|
||||
if (!($argv[1] && $argv[2])) {
|
||||
echo "Usage: php pg2mysql_cli.php <inputfilename> <outputfilename> [engine]\n";
|
||||
exit();
|
||||
} else {
|
||||
@@ -141,7 +141,7 @@ function pg2mysql_large($infilename, $outfilename)
|
||||
echo "Filesize: " . formatsize($fs) . "\n";
|
||||
|
||||
while ($instr = fgets($infp)) {
|
||||
$linenum ++;
|
||||
$linenum++;
|
||||
$memusage = round(memory_get_usage(true) / 1024 / 1024);
|
||||
$len = strlen($instr);
|
||||
$pgsqlchunk[] = $instr;
|
||||
@@ -163,7 +163,7 @@ function pg2mysql_large($infilename, $outfilename)
|
||||
}
|
||||
|
||||
if (strlen($instr) > 3 && ($instr[$len - 3] == ")" && $instr[$len - 2] == ";" && $instr[$len - 1] == "\n") && $inquotes == false) {
|
||||
$chunkcount ++;
|
||||
$chunkcount++;
|
||||
|
||||
if ($linenum % 10000 == 0) {
|
||||
$currentpos = ftell($infp);
|
||||
@@ -302,7 +302,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
$output .= 'DROP TABLE IF EXISTS `' . $reg2[1] . '`;' . "\n";
|
||||
}
|
||||
$output .= $line;
|
||||
$linenumber ++;
|
||||
$linenumber++;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
$output .= $tbl_extra;
|
||||
$output .= $line;
|
||||
|
||||
$linenumber ++;
|
||||
$linenumber++;
|
||||
$tbl_extra = "";
|
||||
continue;
|
||||
}
|
||||
@@ -395,10 +395,10 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
if (strstr($line, " CONSTRAINT ")) {
|
||||
$line = "";
|
||||
// and if the previous output ended with a , remove the ,
|
||||
$lastchr = substr($output, - 2, 1);
|
||||
$lastchr = substr($output, -2, 1);
|
||||
// echo "lastchr=$lastchr";
|
||||
if ($lastchr == ",") {
|
||||
$output = substr($output, 0, - 2) . "\n";
|
||||
$output = substr($output, 0, -2) . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,9 +408,9 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
if (substr($line, 0, 11) == "INSERT INTO") {
|
||||
$line = str_replace('public.', '', $line);
|
||||
|
||||
if (substr($line, - 3, - 1) == ");") {
|
||||
if (substr($line, -3, -1) == ");") {
|
||||
// we have a complete insert on one line
|
||||
list ($before, $after) = explode(" VALUES ", $line, 2);
|
||||
list($before, $after) = explode(" VALUES ", $line, 2);
|
||||
// we only replace the " with ` in what comes BEFORE the VALUES
|
||||
// (ie, field names, like INSERT INTO table ("bla","bla2") VALUES ('s:4:"test"','bladata2');
|
||||
// should convert to INSERT INTO table (`bla`,`bla2`) VALUES ('s:4:"test"','bladata2');
|
||||
@@ -424,13 +424,13 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
$after = str_replace(", E'", ", '", $after);
|
||||
|
||||
$output .= $before . " VALUES " . $after;
|
||||
$linenumber ++;
|
||||
$linenumber++;
|
||||
continue;
|
||||
} else {
|
||||
// this insert spans multiple lines, so keep dumping the lines until we reach a line
|
||||
// that ends with ");"
|
||||
|
||||
list ($before, $after) = explode(" VALUES ", $line, 2);
|
||||
list($before, $after) = explode(" VALUES ", $line, 2);
|
||||
// we only replace the " with ` in what comes BEFORE the VALUES
|
||||
// (ie, field names, like INSERT INTO table ("bla","bla2") VALUES ('s:4:"test"','bladata2');
|
||||
// should convert to INSERT INTO table (`bla`,`bla2`) VALUES ('s:4:"test"','bladata2');
|
||||
@@ -453,7 +453,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
|
||||
$output .= $before . " VALUES " . $after;
|
||||
do {
|
||||
$linenumber ++;
|
||||
$linenumber++;
|
||||
|
||||
// in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string')
|
||||
// ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character
|
||||
@@ -477,7 +477,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
}
|
||||
// echo "inquotes=$inquotes\n";
|
||||
}
|
||||
} while (substr($lines[$linenumber], - 3, - 1) != ");" || $inquotes);
|
||||
} while (substr($lines[$linenumber], -3, -1) != ");" || $inquotes);
|
||||
}
|
||||
}
|
||||
if (substr($line, 0, 16) == "ALTER TABLE ONLY") {
|
||||
@@ -486,14 +486,14 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
$line = str_replace("public.", "", $line);
|
||||
$pkey = $line;
|
||||
|
||||
$linenumber ++;
|
||||
$linenumber++;
|
||||
if (!empty($lines[$linenumber])) {
|
||||
$line = $lines[$linenumber];
|
||||
} else {
|
||||
$line = '';
|
||||
}
|
||||
|
||||
if (strstr($line, " PRIMARY KEY ") && substr($line, - 3, - 1) == ");") {
|
||||
if (strstr($line, " PRIMARY KEY ") && substr($line, -3, -1) == ");") {
|
||||
$reg2 = array();
|
||||
if (preg_match('/ALTER TABLE ([^\s]+)/', $pkey, $reg2)) {
|
||||
if (empty($arrayofprimaryalreadyintabledef[$reg2[1]])) {
|
||||
@@ -580,7 +580,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
}
|
||||
}
|
||||
|
||||
$linenumber ++;
|
||||
$linenumber++;
|
||||
}
|
||||
|
||||
return array('output' => $output,'outputatend' => $outputatend);
|
||||
|
||||
3
dev/tools/php-cs-fixer/.gitignore
vendored
Normal file
3
dev/tools/php-cs-fixer/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/vendor/
|
||||
/composer.json
|
||||
/composer.lock
|
||||
42
dev/tools/run-php-cs-fixer.sh → dev/tools/php-cs-fixer/run-php-cs-fixer.sh
Normal file → Executable file
42
dev/tools/run-php-cs-fixer.sh → dev/tools/php-cs-fixer/run-php-cs-fixer.sh
Normal file → Executable file
@@ -6,7 +6,7 @@
|
||||
# Optionally set COMPOSER_VENDOR_DIR to your vendor path for composer.
|
||||
#
|
||||
# Run php-cs-fixer by calling this script:
|
||||
# ./run-php-cs-fixer.sh check # Only checks (the default)
|
||||
# ./run-php-cs-fixer.sh check # Only checks (not available with PHP 7.0)
|
||||
# ./run-php-cs-fixer.sh fix # Fixes
|
||||
#
|
||||
# You can fix only a few files using
|
||||
@@ -19,7 +19,7 @@
|
||||
# COMPOSER_CMD="php ~/composer.phar" COMPOSER_VENDOR_DIR="~/vendor" ./run-php-cs-fixer.sh
|
||||
#
|
||||
# or export them:
|
||||
# export COMPOSER_CMD="php ~/composer.phar"
|
||||
# export COMPOSER_CMD="~/composer.phar"
|
||||
# export COMPOSER_VENDOR_DIR="~/vendor"
|
||||
# ./run-php-cs-fixer.sh
|
||||
#
|
||||
@@ -29,24 +29,52 @@
|
||||
|
||||
MYDIR=$(dirname "$(realpath "$0")")
|
||||
export COMPOSER_VENDOR_DIR=${COMPOSER_VENDOR_DIR:=$MYDIR/vendor}
|
||||
COMPOSER_CMD=${COMPOSER_CMD:=composer}
|
||||
COMPOSER_CMD=${COMPOSER_CMD:composer}
|
||||
MINPHPVERSION="7.0"
|
||||
|
||||
|
||||
echo "***** run-php-cs-fixer.sh *****"
|
||||
|
||||
if [ "x$1" = "x" ]; then
|
||||
echo "Syntax: run-php-cs-fixer.sh check|fix [path]"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Install/update
|
||||
# Check composer is available
|
||||
#
|
||||
if [ ! -r "${COMPOSER_CMD}" ] ; then
|
||||
echo composer is not available or not in path. You can give the path of composer by setting COMPOSER_CMD=/pathto/composer
|
||||
echo Example: export COMPOSER_CMD="~/composer.phar"
|
||||
echo Example: export COMPOSER_CMD="/usr/local/bin/composer"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Install/update php-cs-fixer
|
||||
#
|
||||
echo Install php-cs-fixer
|
||||
PHP_CS_FIXER="${COMPOSER_VENDOR_DIR}/bin/php-cs-fixer"
|
||||
if [ ! -r "${PHP_CS_FIXER}" ] ; then
|
||||
[[ ! -e "${COMPOSER_VENDOR_DIR}" ]] && ${COMPOSER_CMD} install
|
||||
[[ -e "${COMPOSER_VENDOR_DIR}" ]] && ${COMPOSER_CMD} update
|
||||
${COMPOSER_CMD} require --dev friendsofphp/php-cs-fixer
|
||||
php${MINPHPVERSION} ${COMPOSER_CMD} require --dev friendsofphp/php-cs-fixer
|
||||
echo
|
||||
fi
|
||||
|
||||
|
||||
# With PHP 7.0, php-cs-fixer is V2 (command check not supported)
|
||||
# With PHP 8.2, php-cs-fixer is V3
|
||||
|
||||
(
|
||||
cd "${MYDIR}/../.." || exit
|
||||
echo cd "${MYDIR}/../../.."
|
||||
cd "${MYDIR}/../../.." || exit
|
||||
CMD=
|
||||
# If no argument, run check by default
|
||||
[[ "$1" == "" ]] && CMD=check
|
||||
# shellcheck disable=SC2086
|
||||
"${PHP_CS_FIXER}" $CMD "$@"
|
||||
echo php${MINPHPVERSION} "${PHP_CS_FIXER}" $CMD "$@"
|
||||
php${MINPHPVERSION} "${PHP_CS_FIXER}" $CMD "$@"
|
||||
)
|
||||
@@ -13,6 +13,7 @@ Install rector with composer
|
||||
composer install
|
||||
```
|
||||
|
||||
|
||||
#### Usage
|
||||
|
||||
##### To make changes (Add --dry-run for test mode only)
|
||||
|
||||
@@ -53,9 +53,11 @@ class EmptyGlobalToFunction extends AbstractRector
|
||||
{
|
||||
return new RuleDefinition(
|
||||
'Change $conf->global to getDolGlobal',
|
||||
[new CodeSample('$conf->global->CONSTANT',
|
||||
[new CodeSample(
|
||||
'$conf->global->CONSTANT',
|
||||
'getDolGlobalInt(\'CONSTANT\')'
|
||||
)]);
|
||||
)]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,7 +108,7 @@ class EmptyGlobalToFunction extends AbstractRector
|
||||
return new FuncCall(
|
||||
new Name('getDolGlobalString'),
|
||||
[new Arg($constName)]
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +138,7 @@ class EmptyGlobalToFunction extends AbstractRector
|
||||
return new BooleanNot(new FuncCall(
|
||||
new Name('getDolGlobalString'),
|
||||
[new Arg($constName)]
|
||||
));
|
||||
));
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -169,7 +171,7 @@ class EmptyGlobalToFunction extends AbstractRector
|
||||
}
|
||||
return \true;
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,9 +56,11 @@ class GlobalToFunction extends AbstractRector
|
||||
{
|
||||
return new RuleDefinition(
|
||||
'Change $conf->global to getDolGlobal',
|
||||
[new CodeSample('$conf->global->CONSTANT',
|
||||
[new CodeSample(
|
||||
'$conf->global->CONSTANT',
|
||||
'getDolGlobalInt(\'CONSTANT\')'
|
||||
)]);
|
||||
)]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -188,36 +190,36 @@ class GlobalToFunction extends AbstractRector
|
||||
new FuncCall(
|
||||
new Name($funcName),
|
||||
[new Arg($constName)]
|
||||
),
|
||||
),
|
||||
$node->right
|
||||
);
|
||||
);
|
||||
}
|
||||
if ($typeofcomparison == 'GreaterOrEqual') {
|
||||
return new GreaterOrEqual(
|
||||
new FuncCall(
|
||||
new Name($funcName),
|
||||
[new Arg($constName)]
|
||||
),
|
||||
),
|
||||
$node->right
|
||||
);
|
||||
);
|
||||
}
|
||||
if ($typeofcomparison == 'Smaller') {
|
||||
return new Smaller(
|
||||
new FuncCall(
|
||||
new Name($funcName),
|
||||
[new Arg($constName)]
|
||||
),
|
||||
),
|
||||
$node->right
|
||||
);
|
||||
);
|
||||
}
|
||||
if ($typeofcomparison == 'SmallerOrEqual') {
|
||||
return new SmallerOrEqual(
|
||||
new FuncCall(
|
||||
new Name($funcName),
|
||||
[new Arg($constName)]
|
||||
),
|
||||
),
|
||||
$node->right
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Dolibarr\Rector\Renaming;
|
||||
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
@@ -36,7 +35,8 @@ class UserRightsToFunction extends AbstractRector
|
||||
[new CodeSample(
|
||||
'$user->rights->module->permission',
|
||||
'$user->hasRight(\'module\', \'permission\')'
|
||||
)]);
|
||||
)]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +62,6 @@ class UserRightsToFunction extends AbstractRector
|
||||
*/
|
||||
public function refactor(Node $node)
|
||||
{
|
||||
|
||||
if ($node instanceof Node\Stmt\ClassMethod) {
|
||||
$excludeMethods = ['getrights', 'hasRight'];
|
||||
/** @var \PHPStan\Analyser\MutatingScope $scope */
|
||||
@@ -122,7 +121,7 @@ class UserRightsToFunction extends AbstractRector
|
||||
return null;
|
||||
}
|
||||
// Add a test to avoid rector error on html.formsetup.class.php
|
||||
if (! $node->name instanceof Node\Expr\Variable && is_null($this->getName($node))) {
|
||||
if (!$node->name instanceof Node\Expr\Variable && is_null($this->getName($node))) {
|
||||
//var_dump($node);
|
||||
return null;
|
||||
//exit;
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
* - Exclude param optioncss, token, sortfield, sortorder
|
||||
*/
|
||||
|
||||
$crawledLinks=array();
|
||||
const MAX_DEPTH=2;
|
||||
$crawledLinks = array();
|
||||
const MAX_DEPTH = 2;
|
||||
|
||||
|
||||
/**
|
||||
@@ -36,35 +36,38 @@ const MAX_DEPTH=2;
|
||||
function followLink($url, $depth = 0)
|
||||
{
|
||||
global $crawledLinks;
|
||||
$crawling=array();
|
||||
if ($depth>MAX_DEPTH) {
|
||||
$crawling = array();
|
||||
if ($depth > MAX_DEPTH) {
|
||||
echo "<div style='color:red;'>The Crawler is giving up!</div>";
|
||||
return;
|
||||
}
|
||||
$options=array(
|
||||
'http'=>array(
|
||||
'method'=>"GET",
|
||||
'user-agent'=>"gfgBot/0.1\n"
|
||||
$options = array(
|
||||
'http' => array(
|
||||
'method' => "GET",
|
||||
'user-agent' => "gfgBot/0.1\n"
|
||||
)
|
||||
);
|
||||
$context=stream_context_create($options);
|
||||
$doc=new DomDocument();
|
||||
$context = stream_context_create($options);
|
||||
$doc = new DomDocument();
|
||||
@$doc->loadHTML(file_get_contents($url, false, $context));
|
||||
$links=$doc->getElementsByTagName('a');
|
||||
$pageTitle=getDocTitle($doc, $url);
|
||||
$metaData=getDocMetaData($doc);
|
||||
$links = $doc->getElementsByTagName('a');
|
||||
$pageTitle = getDocTitle($doc, $url);
|
||||
$metaData = getDocMetaData($doc);
|
||||
foreach ($links as $i) {
|
||||
$link=$i->getAttribute('href');
|
||||
if (ignoreLink($link)) continue;
|
||||
$link=convertLink($url, $link);
|
||||
$link = $i->getAttribute('href');
|
||||
if (ignoreLink($link)) {
|
||||
continue;
|
||||
}
|
||||
$link = convertLink($url, $link);
|
||||
if (!in_array($link, $crawledLinks)) {
|
||||
$crawledLinks[]=$link;
|
||||
$crawling[]=$link;
|
||||
$crawledLinks[] = $link;
|
||||
$crawling[] = $link;
|
||||
insertIntoDatabase($link, $pageTitle, $metaData, $depth);
|
||||
}
|
||||
}
|
||||
foreach ($crawling as $crawlURL)
|
||||
followLink($crawlURL, $depth+1);
|
||||
foreach ($crawling as $crawlURL) {
|
||||
followLink($crawlURL, $depth + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,14 +77,16 @@ function followLink($url, $depth = 0)
|
||||
*/
|
||||
function convertLink($site, $path)
|
||||
{
|
||||
if (substr_compare($path, "//", 0, 2)==0)
|
||||
if (substr_compare($path, "//", 0, 2) == 0) {
|
||||
return parse_url($site)['scheme'].$path;
|
||||
elseif (substr_compare($path, "http://", 0, 7)==0
|
||||
or substr_compare($path, "https://", 0, 8)==0
|
||||
or substr_compare($path, "www.", 0, 4)==0
|
||||
)
|
||||
} elseif (substr_compare($path, "http://", 0, 7) == 0
|
||||
or substr_compare($path, "https://", 0, 8) == 0
|
||||
or substr_compare($path, "www.", 0, 4) == 0
|
||||
) {
|
||||
return $path;
|
||||
else return $site.'/'.$path;
|
||||
} else {
|
||||
return $site.'/'.$path;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,7 +95,7 @@ function convertLink($site, $path)
|
||||
*/
|
||||
function ignoreLink($url)
|
||||
{
|
||||
return $url[0]=="#" or substr($url, 0, 11) == "javascript:";
|
||||
return $url[0] == "#" or substr($url, 0, 11) == "javascript:";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,11 +121,12 @@ function insertIntoDatabase($link, $title, &$metaData, $depth)
|
||||
*/
|
||||
function getDocTitle(&$doc, $url)
|
||||
{
|
||||
$titleNodes=$doc->getElementsByTagName('title');
|
||||
if (count($titleNodes)==0 or !isset($titleNodes[0]->nodeValue))
|
||||
$titleNodes = $doc->getElementsByTagName('title');
|
||||
if (count($titleNodes) == 0 or !isset($titleNodes[0]->nodeValue)) {
|
||||
return $url;
|
||||
$title=str_replace('', '\n', $titleNodes[0]->nodeValue);
|
||||
return (strlen($title)<1)?$url:$title;
|
||||
}
|
||||
$title = str_replace('', '\n', $titleNodes[0]->nodeValue);
|
||||
return (strlen($title) < 1) ? $url : $title;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,16 +135,20 @@ function getDocTitle(&$doc, $url)
|
||||
*/
|
||||
function getDocMetaData(&$doc)
|
||||
{
|
||||
$metaData=array();
|
||||
$metaNodes=$doc->getElementsByTagName('meta');
|
||||
foreach ($metaNodes as $node)
|
||||
$metaData = array();
|
||||
$metaNodes = $doc->getElementsByTagName('meta');
|
||||
foreach ($metaNodes as $node) {
|
||||
$metaData[$node->getAttribute("name")] = $node->getAttribute("content");
|
||||
if (!isset($metaData['description']))
|
||||
$metaData['description']='No Description Available';
|
||||
if (!isset($metaData['keywords'])) $metaData['keywords']='';
|
||||
}
|
||||
if (!isset($metaData['description'])) {
|
||||
$metaData['description'] = 'No Description Available';
|
||||
}
|
||||
if (!isset($metaData['keywords'])) {
|
||||
$metaData['keywords'] = '';
|
||||
}
|
||||
return array(
|
||||
'keywords'=>str_replace('', '\n', $metaData['keywords']),
|
||||
'description'=>str_replace('', '\n', $metaData['description'])
|
||||
'keywords' => str_replace('', '\n', $metaData['keywords']),
|
||||
'description' => str_replace('', '\n', $metaData['description'])
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
//============================================================+
|
||||
// File name : example_016.php
|
||||
// Begin : 2008-03-04
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
// This source file must be UTF-8 encoded
|
||||
/*
|
||||
$filename='filewithé';
|
||||
|
||||
@@ -74,7 +74,6 @@ class autoTranslator
|
||||
*/
|
||||
private function parseRefLangTranslationFiles()
|
||||
{
|
||||
|
||||
$files = $this->getTranslationFilesArray($this->_refLang);
|
||||
$counter = 1;
|
||||
foreach ($files as $file) {
|
||||
@@ -276,7 +275,7 @@ class autoTranslator
|
||||
private function getLineValue($line)
|
||||
{
|
||||
$arraykey = explode('=', $line, 2);
|
||||
return trim(isset($arraykey[1])?$arraykey[1]:'');
|
||||
return trim(isset($arraykey[1]) ? $arraykey[1] : '');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,8 +333,8 @@ class autoTranslator
|
||||
//print "Url to translate: ".$url."\n";
|
||||
|
||||
if (! function_exists("curl_init")) {
|
||||
print "Error, your PHP does not support curl functions.\n";
|
||||
die();
|
||||
print "Error, your PHP does not support curl functions.\n";
|
||||
die();
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
@@ -210,7 +210,8 @@ foreach ($dups as $string => $pages) {
|
||||
$inadmin=0;
|
||||
foreach ($pages as $file => $lines) {
|
||||
if ($file == 'main.lang') {
|
||||
$inmain=1; $inadmin=0;
|
||||
$inmain=1;
|
||||
$inadmin=0;
|
||||
}
|
||||
if ($file == 'admin.lang' && ! $inmain) {
|
||||
$inadmin=1;
|
||||
@@ -568,16 +569,16 @@ if ((!empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($ar
|
||||
if (empty($unused)) {
|
||||
print "No string not used found.\n";
|
||||
} else {
|
||||
$filetosave='/tmp/'.($argv[2]?$argv[2]:"").'notused.lang';
|
||||
$filetosave='/tmp/'.($argv[2] ? $argv[2] : "").'notused.lang';
|
||||
print "Strings in en_US that are never used are saved into file ".$filetosave.":\n";
|
||||
file_put_contents($filetosave, implode("", $unused));
|
||||
print "To remove from original file, run command :\n";
|
||||
if (($argv[2]?$argv[2]:"")) {
|
||||
print 'cd htdocs/langs/en_US; mv '.($argv[2]?$argv[2]:"")." ".($argv[2]?$argv[2]:"").".tmp; ";
|
||||
if (($argv[2] ? $argv[2] : "")) {
|
||||
print 'cd htdocs/langs/en_US; mv '.($argv[2] ? $argv[2] : "")." ".($argv[2] ? $argv[2] : "").".tmp; ";
|
||||
}
|
||||
print "diff ".($argv[2]?$argv[2]:"").".tmp ".$filetosave." | grep \< | cut -b 3- > ".($argv[2]?$argv[2]:"");
|
||||
if (($argv[2]?$argv[2]:"")) {
|
||||
print "; rm ".($argv[2]?$argv[2]:"").".tmp;\n";
|
||||
print "diff ".($argv[2] ? $argv[2] : "").".tmp ".$filetosave." | grep \< | cut -b 3- > ".($argv[2] ? $argv[2] : "");
|
||||
if (($argv[2] ? $argv[2] : "")) {
|
||||
print "; rm ".($argv[2] ? $argv[2] : "").".tmp;\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,10 +58,10 @@ $rc = 0;
|
||||
|
||||
// Get and check arguments
|
||||
|
||||
$lPrimary = isset($argv[1])?$argv[1]:'';
|
||||
$lSecondary = isset($argv[2])?$argv[2]:'';
|
||||
$lPrimary = isset($argv[1]) ? $argv[1] : '';
|
||||
$lSecondary = isset($argv[2]) ? $argv[2] : '';
|
||||
$lEnglish = 'en_US';
|
||||
$filesToProcess = isset($argv[3])?$argv[3]:'';
|
||||
$filesToProcess = isset($argv[3]) ? $argv[3] : '';
|
||||
|
||||
if (empty($lPrimary) || empty($lSecondary) || empty($filesToProcess)) {
|
||||
$rc = 1;
|
||||
@@ -308,7 +308,7 @@ foreach ($filesToProcess as $fileToProcess) {
|
||||
|| in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/', $key) || preg_match('/^FormatHour/', $key)
|
||||
) {
|
||||
//print "Key $key differs (aSecondary=".$aSecondary[$key].", aPrimary=".$aPrimary[$key].", aEnglish=".$aEnglish[$key].") so we add it into new secondary language (line: $cnt).\n";
|
||||
fwrite($oh, $key."=".(empty($aSecondary[$key])?$aPrimary[$key]:$aSecondary[$key])."\n");
|
||||
fwrite($oh, $key."=".(empty($aSecondary[$key]) ? $aPrimary[$key] : $aSecondary[$key])."\n");
|
||||
}
|
||||
}
|
||||
if (! feof($handle)) {
|
||||
|
||||
@@ -39,7 +39,7 @@ $id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$massaction = GETPOST('massaction', 'aZ09');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingaccountlist'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountingaccountlist'; // To manage different context of search
|
||||
$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
|
||||
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
@@ -49,7 +49,7 @@ $search_accountparent = GETPOST('search_accountparent', 'alpha');
|
||||
$search_pcgtype = GETPOST('search_pcgtype', 'alpha');
|
||||
$search_import_key = GETPOST('search_import_key', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
||||
@@ -66,7 +66,7 @@ if (!$user->hasRight('accounting', 'chartofaccount')) {
|
||||
}
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -111,7 +111,8 @@ $hookmanager->initHooks(array('accountancyadminaccount'));
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha')) {
|
||||
$massaction = '';
|
||||
|
||||
@@ -47,7 +47,7 @@ if (isModEnabled('accounting')) {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('accountancy', 'admin', 'companies', 'compta', 'errors', 'holiday', 'hrm', 'resource'));
|
||||
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
|
||||
$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view';
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$id = 31;
|
||||
$rowid = GETPOST('rowid', 'alpha');
|
||||
@@ -59,7 +59,7 @@ $actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"')
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"');
|
||||
|
||||
$listoffset = GETPOST('listoffset', 'alpha');
|
||||
$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000;
|
||||
$listlimit = GETPOST('listlimit', 'int') > 0 ? GETPOST('listlimit', 'int') : 1000;
|
||||
$active = 1;
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'aZ09comma');
|
||||
@@ -472,7 +472,8 @@ if ($id) {
|
||||
}
|
||||
if ($fieldlist[$field] == 'country') {
|
||||
if (in_array('region_id', $fieldlist)) {
|
||||
print '<td> </td>'; continue;
|
||||
print '<td> </td>';
|
||||
continue;
|
||||
} // For region page, we do not show the country input
|
||||
$valuetoshow = $langs->trans("Country");
|
||||
}
|
||||
@@ -519,7 +520,8 @@ if ($id) {
|
||||
$tmpaction = 'create';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) {
|
||||
fieldListAccountModel($fieldlist, $obj, $tabname[$id], 'add');
|
||||
@@ -616,7 +618,8 @@ if ($id) {
|
||||
$tmpaction = 'edit';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) {
|
||||
fieldListAccountModel($fieldlist, $obj, $tabname[$id], 'edit');
|
||||
@@ -629,7 +632,8 @@ if ($id) {
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) {
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
@@ -669,9 +673,11 @@ if ($id) {
|
||||
}
|
||||
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
|
||||
$iserasable = 1;
|
||||
$canbedisabled = 1;
|
||||
$canbemodified = 1; // true by default
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?token='.newToken().($page ? '&page='.$page : '').'&sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
|
||||
$url = $_SERVER["PHP_SELF"].'?token='.newToken().($page ? '&page='.$page : '').'&sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ? urlencode($obj->code) : '');
|
||||
if ($param) {
|
||||
$url .= '&'.$param;
|
||||
}
|
||||
@@ -769,16 +775,17 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context =
|
||||
print '<td>';
|
||||
}
|
||||
if ($fieldlist[$field] == 'type_cdr') {
|
||||
print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''));
|
||||
print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''));
|
||||
} else {
|
||||
print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1);
|
||||
print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''), 1);
|
||||
}
|
||||
print '</td>';
|
||||
} elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
print '<td><input type="text" class="flat" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" size="10" name="'.$fieldlist[$field].'"></td>';
|
||||
print '<td><input type="text" class="flat" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" size="10" name="'.$fieldlist[$field].'"></td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
$size = ''; $class = '';
|
||||
$size = '';
|
||||
$class = '';
|
||||
if ($fieldlist[$field] == 'code') {
|
||||
$size = 'size="8" ';
|
||||
}
|
||||
@@ -791,7 +798,7 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context =
|
||||
if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') {
|
||||
$size = 'size="2" ';
|
||||
}
|
||||
print '<input type="text" '.$size.' class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '<input type="text" '.$size.' class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("errors", "admin", "companies", "resource", "holiday", "accountancy", "hrm"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
|
||||
$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view';
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$id = 32;
|
||||
$rowid = GETPOST('rowid', 'alpha');
|
||||
@@ -53,7 +53,7 @@ $actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"')
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"');
|
||||
|
||||
$listoffset = GETPOST('listoffset', 'alpha');
|
||||
$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000;
|
||||
$listlimit = GETPOST('listlimit', 'int') > 0 ? GETPOST('listlimit', 'int') : 1000;
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'aZ09comma');
|
||||
$sortorder = GETPOST("sortorder", 'aZ09comma');
|
||||
@@ -581,7 +581,8 @@ if ($tabname[$id]) {
|
||||
$tmpaction = 'create';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) {
|
||||
fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'add');
|
||||
@@ -784,7 +785,8 @@ if ($resql) {
|
||||
$tmpaction = 'edit';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
// Actions
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
@@ -810,13 +812,16 @@ if ($resql) {
|
||||
}
|
||||
} else {
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
|
||||
$iserasable = 1;
|
||||
$canbedisabled = 1;
|
||||
$canbemodified = 1; // true by default
|
||||
if (isset($obj->code)) {
|
||||
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
|
||||
$iserasable = 0; $canbedisabled = 0;
|
||||
$iserasable = 0;
|
||||
$canbedisabled = 0;
|
||||
}
|
||||
}
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ? urlencode($obj->code) : '');
|
||||
if ($param) {
|
||||
$url .= '&'.$param;
|
||||
}
|
||||
@@ -828,7 +833,8 @@ if ($resql) {
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
// Actions
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
@@ -872,7 +878,7 @@ if ($resql) {
|
||||
|
||||
// Show value for field
|
||||
if ($showfield) {
|
||||
print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'"'.($title ? ' title="'.dol_escape_htmltag($title).'"': '').'>'.dol_escape_htmltag($valuetoshow).'</td>';
|
||||
print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'"'.($title ? ' title="'.dol_escape_htmltag($title).'"' : '').'>'.dol_escape_htmltag($valuetoshow).'</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -981,10 +987,10 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
|
||||
}
|
||||
} elseif ($fieldlist[$field] == 'category_type') {
|
||||
print '<td>';
|
||||
print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1);
|
||||
print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''), 1);
|
||||
print '</td>';
|
||||
} elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
print '<td><input type="text" class="flat minwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
||||
print '<td><input type="text" class="flat minwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" name="'.$fieldlist[$field].'"></td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
$class = '';
|
||||
@@ -994,7 +1000,7 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
|
||||
if ($fieldlist[$field] == 'position') {
|
||||
$class = 'maxwidth50';
|
||||
}
|
||||
print '<input type="text" class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '<input type="text" class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php';
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
|
||||
@@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin", "compta", "accountancy"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
|
||||
$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view';
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$id = 35;
|
||||
$rowid = GETPOST('rowid', 'alpha');
|
||||
@@ -56,7 +56,7 @@ $actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"')
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"');
|
||||
|
||||
$listoffset = GETPOST('listoffset', 'alpha');
|
||||
$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000;
|
||||
$listlimit = GETPOST('listlimit', 'int') > 0 ? GETPOST('listlimit', 'int') : 1000;
|
||||
$active = 1;
|
||||
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
@@ -452,7 +452,8 @@ if ($id) {
|
||||
$tmpaction = 'create';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) {
|
||||
fieldListJournal($fieldlist, $obj, $tabname[$id], 'add');
|
||||
@@ -561,7 +562,8 @@ if ($id) {
|
||||
$tmpaction = 'edit';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
// Show fields
|
||||
if (empty($reshook)) {
|
||||
@@ -580,7 +582,8 @@ if ($id) {
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) {
|
||||
$langs->load("accountancy");
|
||||
@@ -607,7 +610,9 @@ if ($id) {
|
||||
}
|
||||
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
|
||||
$iserasable = 1;
|
||||
$canbedisabled = 1;
|
||||
$canbemodified = 1; // true by default
|
||||
if (isset($obj->code) && $id != 10) {
|
||||
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
|
||||
$iserasable = 0;
|
||||
@@ -617,7 +622,7 @@ if ($id) {
|
||||
|
||||
$canbemodified = $iserasable;
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ? urlencode($obj->code) : '');
|
||||
if ($param) {
|
||||
$url .= '&'.$param;
|
||||
}
|
||||
@@ -700,13 +705,14 @@ function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
if ($fieldlist[$field] == 'nature') {
|
||||
print '<td>';
|
||||
print $form->selectarray('nature', $sourceList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''));
|
||||
print $form->selectarray('nature', $sourceList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''));
|
||||
print '</td>';
|
||||
} elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
print '<td><input type="text" class="flat minwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
||||
print '<td><input type="text" class="flat minwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" name="'.$fieldlist[$field].'"></td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
$size = ''; $class = '';
|
||||
$size = '';
|
||||
$class = '';
|
||||
if ($fieldlist[$field] == 'code') {
|
||||
$class = 'maxwidth100';
|
||||
}
|
||||
@@ -716,7 +722,7 @@ function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') {
|
||||
$size = 'size="2" ';
|
||||
}
|
||||
print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ if (empty($accounting_product_mode)) {
|
||||
$accounting_product_mode = 'ACCOUNTANCY_SELL';
|
||||
}
|
||||
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : getDolGlobalInt('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit);
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalInt('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -136,7 +136,8 @@ if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
@@ -184,7 +185,9 @@ if ($action == 'update') {
|
||||
//$msg .= '<div><span class="accountingprocessing">' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '</span></div>';
|
||||
$arrayofdifferentselectedvalues = array();
|
||||
|
||||
$cpt = 0; $ok = 0; $ko = 0;
|
||||
$cpt = 0;
|
||||
$ok = 0;
|
||||
$ko = 0;
|
||||
foreach ($chk_prod as $productid) {
|
||||
$accounting_account_id = GETPOST('codeventil_'.$productid);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ $rowid = GETPOST('rowid', 'int');
|
||||
$massaction = GETPOST('massaction', 'aZ09');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingsubaccountlist'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountingsubaccountlist'; // To manage different context of search
|
||||
|
||||
$search_subaccount = GETPOST('search_subaccount', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
@@ -55,7 +55,7 @@ if (!$user->hasRight('accounting', 'chartofaccount')) {
|
||||
}
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -89,7 +89,8 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha')) {
|
||||
$massaction = '';
|
||||
|
||||
@@ -64,7 +64,7 @@ if ($search_accountancy_code_end == - 1) {
|
||||
$search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
|
||||
@@ -134,7 +134,7 @@ $search_lettering_code = GETPOST('search_lettering_code', 'alpha');
|
||||
$search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
@@ -237,7 +237,8 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
$param = '';
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha')) {
|
||||
$massaction = '';
|
||||
@@ -1028,7 +1029,8 @@ print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');
|
||||
}
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
||||
}
|
||||
@@ -1093,7 +1095,7 @@ $totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
$totalarray['val'] = array ();
|
||||
$totalarray['val'] = array();
|
||||
$totalarray['val']['totaldebit'] = 0;
|
||||
$totalarray['val']['totalcredit'] = 0;
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ $search_lettering_code = GETPOST('search_lettering_code', 'alpha');
|
||||
$search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
@@ -225,7 +225,8 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
$param = '';
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto' && $massaction != 'preunletteringmanual' && $massaction != 'predeletebookkeepingwriting') {
|
||||
$massaction = '';
|
||||
@@ -979,7 +980,8 @@ print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');
|
||||
}
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
||||
}
|
||||
@@ -1044,7 +1046,7 @@ $totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
$totalarray['val'] = array ();
|
||||
$totalarray['val'] = array();
|
||||
$totalarray['val']['totaldebit'] = 0;
|
||||
$totalarray['val']['totalcredit'] = 0;
|
||||
|
||||
|
||||
@@ -966,7 +966,7 @@ $displayed_account_number = null; // Start with undefined to be able to distingu
|
||||
$i = 0;
|
||||
|
||||
$totalarray = array();
|
||||
$totalarray['val'] = array ();
|
||||
$totalarray['val'] = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
@@ -993,18 +993,40 @@ while ($i < min($num, $limit)) {
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
$colspan++;
|
||||
}
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
if (!empty($arrayfields['t.code_journal']['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
if (!empty($arrayfields['t.doc_date']['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
if (!empty($arrayfields['t.doc_ref']['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
if (!empty($arrayfields['t.label_operation']['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
if (!empty($arrayfields['t.lettering_code']['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['t.balance']['checked'])) { $colspanend++; }
|
||||
if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; }
|
||||
if (!empty($arrayfields['t.date_validated']['checked'])) { $colspanend++; }
|
||||
if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; }
|
||||
if (!empty($arrayfields['t.import_key']['checked'])) { $colspanend++; }
|
||||
if (!empty($arrayfields['t.balance']['checked'])) {
|
||||
$colspanend++;
|
||||
}
|
||||
if (!empty($arrayfields['t.date_export']['checked'])) {
|
||||
$colspanend++;
|
||||
}
|
||||
if (!empty($arrayfields['t.date_validated']['checked'])) {
|
||||
$colspanend++;
|
||||
}
|
||||
if (!empty($arrayfields['t.lettering_code']['checked'])) {
|
||||
$colspanend++;
|
||||
}
|
||||
if (!empty($arrayfields['t.import_key']['checked'])) {
|
||||
$colspanend++;
|
||||
}
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
$colspan++;
|
||||
$colspanend--;
|
||||
@@ -1022,7 +1044,9 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
print '<td class="nowrap right">'.price(price2num($sous_total_debit, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($sous_total_credit, 'MT')).'</td>';
|
||||
if ($colspanend > 0) print '<td colspan="'.$colspanend.'"></td>';
|
||||
if ($colspanend > 0) {
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
// Show balance of last shown account
|
||||
$balance = $sous_total_debit - $sous_total_credit;
|
||||
@@ -1039,7 +1063,9 @@ while ($i < min($num, $limit)) {
|
||||
print price(price2num($sous_total_credit - $sous_total_debit, 'MT'));
|
||||
print '</td>';
|
||||
}
|
||||
if ($colspanend > 0) print '<td colspan="'.$colspanend.'"></td>';
|
||||
if ($colspanend > 0) {
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@@ -1310,7 +1336,9 @@ if ($num > 0 && $colspan > 0) {
|
||||
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($sous_total_debit, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($sous_total_credit, 'MT')).'</td>';
|
||||
if ($colspanend > 0) print '<td colspan="'.$colspanend.'"></td>';
|
||||
if ($colspanend > 0) {
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
// Show balance of last shown account
|
||||
$balance = $sous_total_debit - $sous_total_credit;
|
||||
@@ -1327,7 +1355,9 @@ if ($num > 0 && $colspan > 0) {
|
||||
print price(price2num($sous_total_credit - $sous_total_debit, 'MT'));
|
||||
print '</td>';
|
||||
}
|
||||
if ($colspanend > 0) print '<td colspan="'.$colspanend.'"></td>';
|
||||
if ($colspanend > 0) {
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
@@ -228,7 +228,8 @@ class AccountancyCategory // extends CommonObject
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
@@ -369,7 +370,8 @@ class AccountancyCategory // extends CommonObject
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
@@ -407,7 +409,8 @@ class AccountancyCategory // extends CommonObject
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
|
||||
@@ -489,7 +489,7 @@ class AccountancyExport
|
||||
case self::$EXPORT_TYPE_FEC2:
|
||||
$archiveFileList = $this->exportFEC2($TData, $exportFile, $archiveFileList, $withAttachment);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_ISUITEEXPERT :
|
||||
case self::$EXPORT_TYPE_ISUITEEXPERT:
|
||||
$this->exportiSuiteExpert($TData, $exportFile);
|
||||
break;
|
||||
default:
|
||||
@@ -1003,7 +1003,9 @@ class AccountancyExport
|
||||
// skip native invoice pdfs (canelle)
|
||||
// We want to retrieve an attachment representative of the supplier invoice, not a fake document generated by Dolibarr.
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($fileFound['name'] === $objectFileName.'.pdf') continue;
|
||||
if ($fileFound['name'] === $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
} elseif ($fileFound['name'] !== $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
@@ -1141,7 +1143,6 @@ class AccountancyExport
|
||||
*/
|
||||
public function exportEbp($objectLines, $exportFile = null)
|
||||
{
|
||||
|
||||
$separator = ',';
|
||||
$end_line = "\n";
|
||||
|
||||
@@ -1472,7 +1473,9 @@ class AccountancyExport
|
||||
// skip native invoice pdfs (canelle)
|
||||
// We want to retrieve an attachment representative of the supplier invoice, not a fake document generated by Dolibarr.
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($fileFound['name'] === $objectFileName.'.pdf') continue;
|
||||
if ($fileFound['name'] === $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
} elseif ($fileFound['name'] !== $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
@@ -1681,7 +1684,9 @@ class AccountancyExport
|
||||
// skip native invoice pdfs (canelle)
|
||||
// We want to retrieve an attachment representative of the supplier invoice, not a fake document generated by Dolibarr.
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($fileFound['name'] === $objectFileName.'.pdf') continue;
|
||||
if ($fileFound['name'] === $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
} elseif ($fileFound['name'] !== $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
@@ -1883,7 +1888,6 @@ class AccountancyExport
|
||||
*/
|
||||
public function exportLDCompta($objectLines, $exportFile = null)
|
||||
{
|
||||
|
||||
$separator = ';';
|
||||
$end_line = "\r\n";
|
||||
|
||||
@@ -2490,7 +2494,6 @@ class AccountancyExport
|
||||
*/
|
||||
public function exportGestimumV5($objectLines, $exportFile = null)
|
||||
{
|
||||
|
||||
$separator = ',';
|
||||
$end_line = "\r\n";
|
||||
|
||||
|
||||
@@ -84,12 +84,12 @@ class AccountingJournal extends CommonObject
|
||||
/**
|
||||
* @var array Accounting account cached
|
||||
*/
|
||||
static public $accounting_account_cached = array();
|
||||
public static $accounting_account_cached = array();
|
||||
|
||||
/**
|
||||
* @var array Nature mapping
|
||||
*/
|
||||
static public $nature_maps = array(
|
||||
public static $nature_maps = array(
|
||||
1 => 'variousoperations',
|
||||
2 => 'sells',
|
||||
3 => 'purchases',
|
||||
@@ -386,8 +386,12 @@ class AccountingJournal extends CommonObject
|
||||
global $hookmanager;
|
||||
|
||||
// Clean parameters
|
||||
if (empty($type)) $type = 'view';
|
||||
if (empty($in_bookkeeping)) $in_bookkeeping = 'notyet';
|
||||
if (empty($type)) {
|
||||
$type = 'view';
|
||||
}
|
||||
if (empty($in_bookkeeping)) {
|
||||
$in_bookkeeping = 'notyet';
|
||||
}
|
||||
|
||||
$data = array();
|
||||
|
||||
@@ -659,9 +663,11 @@ class AccountingJournal extends CommonObject
|
||||
$lines[0][$accountancy_code_depreciation_asset] = -$last_cumulative_amount_ht;
|
||||
$lines[0][$accountancy_code_asset] = $element_static->acquisition_value_ht;
|
||||
|
||||
$disposal_amount_vat = $disposal_subject_to_vat ? (double) price2num($disposal_amount * $disposal_vat / 100, 'MT') : 0;
|
||||
$disposal_amount_vat = $disposal_subject_to_vat ? (float) price2num($disposal_amount * $disposal_vat / 100, 'MT') : 0;
|
||||
$lines[1][$accountancy_code_receivable_on_assignment] = -($disposal_amount + $disposal_amount_vat);
|
||||
if ($disposal_subject_to_vat) $lines[1][$accountancy_code_vat_collected] = $disposal_amount_vat;
|
||||
if ($disposal_subject_to_vat) {
|
||||
$lines[1][$accountancy_code_vat_collected] = $disposal_amount_vat;
|
||||
}
|
||||
$lines[1][$accountancy_code_proceeds_from_sales] = $disposal_amount;
|
||||
|
||||
foreach ($lines as $lines_block) {
|
||||
@@ -925,7 +931,9 @@ class AccountingJournal extends CommonObject
|
||||
{
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
if (empty($sep)) $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
if (empty($sep)) {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
}
|
||||
$out = '';
|
||||
|
||||
// Hook
|
||||
@@ -976,7 +984,9 @@ class AccountingJournal extends CommonObject
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($header)) $out .= '"' . implode('"' . $sep . '"', $header) . '"' . "\n";
|
||||
if (!empty($header)) {
|
||||
$out .= '"' . implode('"' . $sep . '"', $header) . '"' . "\n";
|
||||
}
|
||||
foreach ($journal_data as $element_id => $element) {
|
||||
foreach ($element['blocks'] as $lines) {
|
||||
foreach ($lines as $line) {
|
||||
|
||||
@@ -2474,7 +2474,9 @@ class BookKeeping extends CommonObject
|
||||
$sql = "SELECT rowid, label, date_start, date_end, statut";
|
||||
$sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear";
|
||||
$sql .= " WHERE entity = " . ((int) $conf->entity);
|
||||
if (!empty($filter)) $sql .= " AND (" . $filter . ')';
|
||||
if (!empty($filter)) {
|
||||
$sql .= " AND (" . $filter . ')';
|
||||
}
|
||||
$sql .= $this->db->order('date_start', 'ASC');
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@@ -469,9 +469,15 @@ class Lettering extends BookKeeping
|
||||
$group_error++;
|
||||
break;
|
||||
}
|
||||
if (!isset($lettering_code)) $lettering_code = (string) $line_infos['lettering_code'];
|
||||
if (!empty($line_infos['lettering_code'])) $do_it = true;
|
||||
} elseif (!empty($line_infos['lettering_code'])) $do_it = false;
|
||||
if (!isset($lettering_code)) {
|
||||
$lettering_code = (string) $line_infos['lettering_code'];
|
||||
}
|
||||
if (!empty($line_infos['lettering_code'])) {
|
||||
$do_it = true;
|
||||
}
|
||||
} elseif (!empty($line_infos['lettering_code'])) {
|
||||
$do_it = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check balance amount
|
||||
@@ -482,8 +488,11 @@ class Lettering extends BookKeeping
|
||||
|
||||
// Lettering/Unlettering the group of bookkeeping lines
|
||||
if (!$group_error && $do_it) {
|
||||
if ($unlettering) $result = $this->deleteLettering($bookkeeping_lines);
|
||||
else $result = $this->updateLettering($bookkeeping_lines);
|
||||
if ($unlettering) {
|
||||
$result = $this->deleteLettering($bookkeeping_lines);
|
||||
} else {
|
||||
$result = $this->updateLettering($bookkeeping_lines);
|
||||
}
|
||||
if ($result < 0) {
|
||||
$group_error++;
|
||||
} elseif ($result > 0) {
|
||||
@@ -534,7 +543,9 @@ class Lettering extends BookKeeping
|
||||
$sql .= " AND pn.piece_num = ab.piece_num";
|
||||
$sql .= " )";
|
||||
}
|
||||
if ($only_has_subledger_account) $sql .= " AND ab.subledger_account != ''";
|
||||
if ($only_has_subledger_account) {
|
||||
$sql .= " AND ab.subledger_account != ''";
|
||||
}
|
||||
|
||||
dol_syslog(__METHOD__ . " - Get all bookkeeping lines", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@@ -608,7 +619,9 @@ class Lettering extends BookKeeping
|
||||
$sql .= " AND dpn.piece_num = ab.piece_num";
|
||||
$sql .= " )";
|
||||
$sql .= ")";
|
||||
if ($only_has_subledger_account) $sql .= " AND ab.subledger_account != ''";
|
||||
if ($only_has_subledger_account) {
|
||||
$sql .= " AND ab.subledger_account != ''";
|
||||
}
|
||||
|
||||
dol_syslog(__METHOD__ . " - Get all bookkeeping lines linked", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@@ -629,7 +642,9 @@ class Lettering extends BookKeeping
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
if (!empty($group)) $grouped_lines[] = $group;
|
||||
if (!empty($group)) {
|
||||
$grouped_lines[] = $group;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -831,7 +846,9 @@ class Lettering extends BookKeeping
|
||||
|
||||
foreach ($element_ids as $element_id) {
|
||||
// Continue if element id in not found
|
||||
if (!isset($link_by_element[$element_id])) continue;
|
||||
if (!isset($link_by_element[$element_id])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Set the element in the current group
|
||||
$current_group[$element_id] = $element_id;
|
||||
|
||||
@@ -184,9 +184,16 @@ if (isset($current_fiscal_period)) {
|
||||
'value' => $current_fiscal_period['date_end']
|
||||
);
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'],
|
||||
$langs->trans('ValidateMovements'), $langs->trans('DescValidateMovements', $langs->transnoentitiesnoconv("RegistrationInAccounting")),
|
||||
'confirm_step_1', $form_question, '', 1, 300);
|
||||
$formconfirm = $form->formconfirm(
|
||||
$_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'],
|
||||
$langs->trans('ValidateMovements'),
|
||||
$langs->trans('DescValidateMovements', $langs->transnoentitiesnoconv("RegistrationInAccounting")),
|
||||
'confirm_step_1',
|
||||
$form_question,
|
||||
'',
|
||||
1,
|
||||
300
|
||||
);
|
||||
} elseif ($action == 'step_2') {
|
||||
$form_question = array();
|
||||
|
||||
@@ -214,9 +221,16 @@ if (isset($current_fiscal_period)) {
|
||||
'value' => 0
|
||||
);
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'],
|
||||
$langs->trans('AccountancyClosureClose'), $langs->trans('AccountancyClosureConfirmClose'),
|
||||
'confirm_step_2', $form_question, '', 1, 300);
|
||||
$formconfirm = $form->formconfirm(
|
||||
$_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'],
|
||||
$langs->trans('AccountancyClosureClose'),
|
||||
$langs->trans('AccountancyClosureConfirmClose'),
|
||||
'confirm_step_2',
|
||||
$form_question,
|
||||
'',
|
||||
1,
|
||||
300
|
||||
);
|
||||
} elseif ($action == 'step_3') {
|
||||
$form_question = array();
|
||||
|
||||
@@ -249,9 +263,15 @@ if (isset($current_fiscal_period)) {
|
||||
'label' => $langs->trans('DateEnd'),
|
||||
'value' => $current_fiscal_period['date_end']
|
||||
);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'],
|
||||
$langs->trans('AccountancyClosureAccountingReversal'), $langs->trans('AccountancyClosureConfirmAccountingReversal'),
|
||||
'confirm_step_3', $form_question, '', 1, 300
|
||||
$formconfirm = $form->formconfirm(
|
||||
$_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'],
|
||||
$langs->trans('AccountancyClosureAccountingReversal'),
|
||||
$langs->trans('AccountancyClosureConfirmAccountingReversal'),
|
||||
'confirm_step_3',
|
||||
$form_question,
|
||||
'',
|
||||
1,
|
||||
300
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -309,7 +329,9 @@ if (isset($current_fiscal_period)) {
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
$nb_years = is_array($count_by_month['list']) ? count($count_by_month['list']) : 0;
|
||||
if ($nb_years > 1) print '<td class="right">' . $langs->trans("Year") . '</td>';
|
||||
if ($nb_years > 1) {
|
||||
print '<td class="right">' . $langs->trans("Year") . '</td>';
|
||||
}
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
print '<td class="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
@@ -319,7 +341,9 @@ if (isset($current_fiscal_period)) {
|
||||
if (is_array($count_by_month['list'])) {
|
||||
foreach ($count_by_month['list'] as $info) {
|
||||
print '<tr class="oddeven">';
|
||||
if ($nb_years > 1) print '<td class="right">' . $info['year'] . '</td>';
|
||||
if ($nb_years > 1) {
|
||||
print '<td class="right">' . $info['year'] . '</td>';
|
||||
}
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
print '<td class="right">' . ((int) $info['count'][$i]) . '</td>';
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ if ($action == 'validatehistory') {
|
||||
$db->rollback();
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
|
||||
if ($nbbindfailed) {
|
||||
setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings');
|
||||
}
|
||||
@@ -666,15 +666,21 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql("fd.total_ht < 0",
|
||||
$sql .= " SUM(".$db->ifsql(
|
||||
"MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql(
|
||||
"fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent !
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").")",
|
||||
0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))"
|
||||
).")",
|
||||
0
|
||||
).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("fd.total_ht < 0",
|
||||
$sql .= " SUM(".$db->ifsql(
|
||||
"fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent !
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").") as total";
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))"
|
||||
).") as total";
|
||||
} else {
|
||||
$sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
@@ -682,15 +688,21 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql("fd.total_ht < 0",
|
||||
$sql .= " SUM(".$db->ifsql(
|
||||
"MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql(
|
||||
"fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty)))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty))").")",
|
||||
0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty))"
|
||||
).")",
|
||||
0
|
||||
).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("fd.total_ht < 0",
|
||||
$sql .= " SUM(".$db->ifsql(
|
||||
"fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty)))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty))").") as total";
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty))"
|
||||
).") as total";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
|
||||
|
||||
@@ -80,7 +80,7 @@ if (empty($search_date_start) && getDolGlobalString('ACCOUNTING_DATE_START_BINDI
|
||||
}
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -126,7 +126,8 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
@@ -694,7 +695,7 @@ if ($result) {
|
||||
if ($product_static->tva_tx !== $facture_static_det->tva_tx && price2num($product_static->tva_tx) && price2num($facture_static_det->tva_tx)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
|
||||
$code_vat_differ = 'warning bold';
|
||||
}
|
||||
print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">';
|
||||
print '<td class="right'.($code_vat_differ ? ' '.$code_vat_differ : '').'">';
|
||||
print vatrate($facture_static_det->tva_tx.($facture_static_det->vat_src_code ? ' ('.$facture_static_det->vat_src_code.')' : ''));
|
||||
print '</td>';
|
||||
|
||||
@@ -714,7 +715,8 @@ if ($result) {
|
||||
print '<td class="small">';
|
||||
// First show default account for any products
|
||||
$s = '1. '.(($facture_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
|
||||
$shelp = ''; $ttype = 'help';
|
||||
$shelp = '';
|
||||
$ttype = 'help';
|
||||
if ($suggestedaccountingaccountbydefaultfor == 'eec') {
|
||||
$shelp .= $langs->trans("SaleEEC");
|
||||
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') {
|
||||
@@ -731,7 +733,8 @@ if ($result) {
|
||||
if ($product_static->id > 0) {
|
||||
print '<br>';
|
||||
$s = '2. '.(($facture_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
$shelp = ''; $ttype = 'help';
|
||||
$shelp = '';
|
||||
$ttype = 'help';
|
||||
if ($suggestedaccountingaccountfor == 'eec') {
|
||||
$shelp = $langs->trans("SaleEEC");
|
||||
} elseif ($suggestedaccountingaccountfor == 'eecwithvat') {
|
||||
|
||||
@@ -166,7 +166,7 @@ if ($action == 'validatehistory') {
|
||||
$db->rollback();
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
|
||||
if ($nbbindfailed) {
|
||||
setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings');
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_s
|
||||
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
|
||||
@@ -73,7 +73,7 @@ if (empty($search_date_start) && getDolGlobalString('ACCOUNTING_DATE_START_BINDI
|
||||
}
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -119,7 +119,8 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
@@ -482,7 +483,7 @@ if ($result) {
|
||||
|
||||
// Fees label
|
||||
print '<td>';
|
||||
print ($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code)));
|
||||
print($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code)));
|
||||
print '</td>';
|
||||
|
||||
// Fees description -- Can be null
|
||||
|
||||
@@ -315,7 +315,9 @@ if ($result) {
|
||||
}
|
||||
// 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) continue;
|
||||
if ($links[$key]['type'] == 'user' && !$is_sc) {
|
||||
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'))) {
|
||||
// So we excluded 'company' and 'user' here. We want only payment lines
|
||||
|
||||
@@ -1105,7 +1107,7 @@ if (empty($action) || $action == 'view') {
|
||||
if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1'
|
||||
|| getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == '-1'
|
||||
|| getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == "" || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') {
|
||||
print ($desc ? '' : '<br>').'<div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
print($desc ? '' : '<br>').'<div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
$desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}');
|
||||
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>', $desc);
|
||||
print $desc;
|
||||
|
||||
@@ -216,7 +216,7 @@ if ($result) {
|
||||
$vatdata = $vatdata_cache[$tax_id];
|
||||
} else {
|
||||
$vatdata = getTaxesFromId($tax_id, $mysoc, $mysoc, 0);
|
||||
$vatdata_cache[$tax_id] = $vatdata;
|
||||
$vatdata_cache[$tax_id] = $vatdata;
|
||||
}
|
||||
$compta_tva = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
$compta_localtax1 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
@@ -293,9 +293,9 @@ if ($result) {
|
||||
$tabrclocaltax2[$obj->rowid][$rcd_compta_localtax2] = 0;
|
||||
}
|
||||
|
||||
$rcvat = (double) price2num($obj->total_ttc * $obj->product_buy_vat / 100, 'MT');
|
||||
$rclocalvat1 = (double) price2num($obj->total_ttc * $obj->product_buy_localvat1 / 100, 'MT');
|
||||
$rclocalvat2 = (double) price2num($obj->total_ttc * $obj->product_buy_localvat2 / 100, 'MT');
|
||||
$rcvat = (float) price2num($obj->total_ttc * $obj->product_buy_vat / 100, 'MT');
|
||||
$rclocalvat1 = (float) price2num($obj->total_ttc * $obj->product_buy_localvat1 / 100, 'MT');
|
||||
$rclocalvat2 = (float) price2num($obj->total_ttc * $obj->product_buy_localvat2 / 100, 'MT');
|
||||
|
||||
$tabrctva[$obj->rowid][$rcd_compta_tva] += $rcvat;
|
||||
$tabrctva[$obj->rowid][$rcc_compta_tva] -= $rcvat;
|
||||
@@ -799,19 +799,19 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 !
|
||||
// Third party
|
||||
foreach ($tabttc[$key] as $k => $mt) {
|
||||
//if ($mt) {
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["refsologest"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["refsologest"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -820,19 +820,19 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 !
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
//if ($mt) {
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["refsologest"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '""'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($accountingaccount->label, 32)).'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.dol_trunc($accountingaccount->label, 32).'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["refsologest"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '""'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($accountingaccount->label, 32)).'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.dol_trunc($accountingaccount->label, 32).'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ if ($result) {
|
||||
$vatdata = $vatdata_cache[$tax_id];
|
||||
} else {
|
||||
$vatdata = getTaxesFromId($tax_id, $mysoc, $mysoc, 0);
|
||||
$vatdata_cache[$tax_id] = $vatdata;
|
||||
$vatdata_cache[$tax_id] = $vatdata;
|
||||
}
|
||||
$compta_tva = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
$compta_localtax1 = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
@@ -249,7 +249,7 @@ if ($result) {
|
||||
}
|
||||
}
|
||||
|
||||
$revenuestamp = (double) price2num($obj->revenuestamp, 'MT');
|
||||
$revenuestamp = (float) price2num($obj->revenuestamp, 'MT');
|
||||
|
||||
// Invoice lines
|
||||
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
||||
@@ -291,7 +291,7 @@ if ($result) {
|
||||
|
||||
// Move a part of the retained warrenty into the account of warranty
|
||||
if (getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY') && $obj->retained_warranty > 0) {
|
||||
$retained_warranty = (double) price2num($total_ttc * $obj->retained_warranty / 100, 'MT'); // Calculate the amount of warrenty for this line (using the percent value)
|
||||
$retained_warranty = (float) price2num($total_ttc * $obj->retained_warranty / 100, 'MT'); // Calculate the amount of warrenty for this line (using the percent value)
|
||||
$tabwarranty[$obj->rowid][$compta_soc] += $retained_warranty;
|
||||
$total_ttc -= $retained_warranty;
|
||||
}
|
||||
@@ -309,7 +309,7 @@ if ($result) {
|
||||
if (!empty($revenuestamp)) {
|
||||
$sqlrevenuestamp = "SELECT accountancy_code_sell FROM ".MAIN_DB_PREFIX."c_revenuestamp";
|
||||
$sqlrevenuestamp .= " WHERE fk_pays = ".((int) $mysoc->country_id);
|
||||
$sqlrevenuestamp .= " AND taux = ".((double) $revenuestamp);
|
||||
$sqlrevenuestamp .= " AND taux = ".((float) $revenuestamp);
|
||||
$sqlrevenuestamp .= " AND active = 1";
|
||||
$resqlrevenuestamp = $db->query($sqlrevenuestamp);
|
||||
|
||||
@@ -879,19 +879,19 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 !
|
||||
// Third party
|
||||
foreach ($tabttc[$key] as $k => $mt) {
|
||||
//if ($mt) {
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -900,19 +900,19 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 !
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
//if ($mt) {
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '""'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($accountingaccount->label, 32)).'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.dol_trunc($accountingaccount->label, 32).'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '""'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($accountingaccount->label, 32)).'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.dol_trunc($accountingaccount->label, 32).'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -1280,7 +1280,7 @@ if (empty($action) || $action == 'view') {
|
||||
//var_dump($arrayofvat[$key]); var_dump($key); var_dump($k);
|
||||
$tmpvatrate = (empty($def_tva[$key][$k]) ? (empty($arrayofvat[$key][$k]) ? '' : $arrayofvat[$key][$k]) : join(', ', $def_tva[$key][$k]));
|
||||
print ' - '.$langs->trans("Taxes").' '.$tmpvatrate.' %';
|
||||
print ($numtax ? ' - Localtax '.$numtax : '');
|
||||
print($numtax ? ' - Localtax '.$numtax : '');
|
||||
print "</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
|
||||
@@ -76,8 +76,12 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
|
||||
}
|
||||
|
||||
$data_type = 'view';
|
||||
if ($action == 'writebookkeeping') $data_type = 'bookkeeping';
|
||||
if ($action == 'exportcsv') $data_type = 'csv';
|
||||
if ($action == 'writebookkeeping') {
|
||||
$data_type = 'bookkeeping';
|
||||
}
|
||||
if ($action == 'exportcsv') {
|
||||
$data_type = 'csv';
|
||||
}
|
||||
$journal_data = $object->getData($user, $data_type, $date_start, $date_end, $in_bookkeeping);
|
||||
if (!is_array($journal_data)) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@@ -247,7 +251,9 @@ if ($object->nature == 4) { // Bank journal
|
||||
print '<br>' . img_warning() . ' ' . $langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
|
||||
print ' : ' . $langs->trans("AccountancyAreaDescBank", 9, '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("BankAccounts") . '</strong>');
|
||||
}
|
||||
} else dol_print_error($db);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Button to write into Ledger
|
||||
@@ -288,8 +294,12 @@ print '
|
||||
</script>';
|
||||
|
||||
$object_label = $langs->trans("ObjectsRef");
|
||||
if ($object->nature == 2 || $object->nature == 3) $object_label = $langs->trans("InvoiceRef");
|
||||
if ($object->nature == 5) $object_label = $langs->trans("ExpenseReportRef");
|
||||
if ($object->nature == 2 || $object->nature == 3) {
|
||||
$object_label = $langs->trans("InvoiceRef");
|
||||
}
|
||||
if ($object->nature == 5) {
|
||||
$object_label = $langs->trans("ExpenseReportRef");
|
||||
}
|
||||
|
||||
|
||||
// Show result array
|
||||
@@ -305,7 +315,9 @@ print '<td>' . $langs->trans("Piece") . ' (' . $object_label . ')</td>';
|
||||
print '<td>' . $langs->trans("AccountAccounting") . '</td>';
|
||||
print '<td>' . $langs->trans("SubledgerAccount") . '</td>';
|
||||
print '<td>' . $langs->trans("LabelOperation") . '</td>';
|
||||
if ($object->nature == 4) print '<td class="center">' . $langs->trans("PaymentMode") . '</td>'; // bank
|
||||
if ($object->nature == 4) {
|
||||
print '<td class="center">' . $langs->trans("PaymentMode") . '</td>';
|
||||
} // bank
|
||||
print '<td class="right">' . $langs->trans("AccountingDebit") . '</td>';
|
||||
print '<td class="right">' . $langs->trans("AccountingCredit") . '</td>';
|
||||
print "</tr>\n";
|
||||
@@ -320,7 +332,9 @@ if (is_array($journal_data) && !empty($journal_data)) {
|
||||
print '<td>' . $line['account_accounting'] . '</td>';
|
||||
print '<td>' . $line['subledger_account'] . '</td>';
|
||||
print '<td>' . $line['label_operation'] . '</td>';
|
||||
if ($object->nature == 4) print '<td class="center">' . $line['payment_mode'] . '</td>';
|
||||
if ($object->nature == 4) {
|
||||
print '<td class="center">' . $line['payment_mode'] . '</td>';
|
||||
}
|
||||
print '<td class="right nowraponall">' . $line['debit'] . '</td>';
|
||||
print '<td class="right nowraponall">' . $line['credit'] . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@@ -286,7 +286,7 @@ if ($action == 'validatehistory') {
|
||||
$db->rollback();
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
|
||||
if ($nbbindfailed) {
|
||||
setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings');
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ $search_country = GETPOST('search_country', 'alpha');
|
||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
|
||||
@@ -77,7 +77,7 @@ $search_country = GETPOST('search_country', 'alpha');
|
||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -128,7 +128,8 @@ if (empty($search_date_start) && getDolGlobalString('ACCOUNTING_DATE_START_BINDI
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
@@ -699,7 +700,7 @@ if ($result) {
|
||||
//if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
|
||||
// $code_vat_differ = 'warning bold';
|
||||
//}
|
||||
print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">';
|
||||
print '<td class="right'.($code_vat_differ ? ' '.$code_vat_differ : '').'">';
|
||||
print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''), false, 0, 0, 1);
|
||||
print '</td>';
|
||||
|
||||
@@ -718,7 +719,8 @@ if ($result) {
|
||||
// Found accounts
|
||||
print '<td class="small">';
|
||||
$s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
|
||||
$shelp = ''; $ttype = 'help';
|
||||
$shelp = '';
|
||||
$ttype = 'help';
|
||||
if ($suggestedaccountingaccountbydefaultfor == 'eec') {
|
||||
$shelp .= $langs->trans("SaleEEC");
|
||||
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') {
|
||||
@@ -734,7 +736,8 @@ if ($result) {
|
||||
if ($product_static->id > 0) {
|
||||
print '<br>';
|
||||
$s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
$shelp = ''; $ttype = 'help';
|
||||
$shelp = '';
|
||||
$ttype = 'help';
|
||||
if ($suggestedaccountingaccountfor == 'eec') {
|
||||
$shelp = $langs->trans("SaleEEC");
|
||||
} elseif ($suggestedaccountingaccountfor == 'eecwithvat') {
|
||||
|
||||
@@ -269,7 +269,7 @@ foreach ($dirModMember as $dirroot) {
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
continue;
|
||||
}
|
||||
$modCodeMember = new $file;
|
||||
$modCodeMember = new $file();
|
||||
// Show modules according to features level
|
||||
if ($modCodeMember->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
|
||||
continue;
|
||||
@@ -518,7 +518,7 @@ foreach ($dirmodels as $reldir) {
|
||||
|
||||
if ($modulequalified) {
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print(empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module, 'info')) {
|
||||
print $module->info($langs);
|
||||
|
||||
@@ -38,10 +38,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$langs->loadLangs(array('companies', 'members'));
|
||||
|
||||
// Get Parameters
|
||||
$id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('rowid', 'int');
|
||||
$id = GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('rowid', 'int');
|
||||
|
||||
// Pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -64,7 +64,7 @@ if (GETPOST('actioncode', 'array')) {
|
||||
$actioncode = '0';
|
||||
}
|
||||
} else {
|
||||
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
|
||||
$actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
|
||||
}
|
||||
$search_rowid = GETPOST('search_rowid');
|
||||
$search_agenda_label = GETPOST('search_agenda_label');
|
||||
|
||||
@@ -57,7 +57,7 @@ $cancel = GETPOST('cancel', 'alpha');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$id = GETPOST('id') ?GETPOST('id', 'int') : $rowid;
|
||||
$id = GETPOST('id') ? GETPOST('id', 'int') : $rowid;
|
||||
$typeid = GETPOST('typeid', 'int');
|
||||
$userid = GETPOST('userid', 'int');
|
||||
$socid = GETPOST('socid', 'int');
|
||||
@@ -616,7 +616,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
$action = ($result < 0 || !$error) ? '' : 'create';
|
||||
$action = ($result < 0 || !$error) ? '' : 'create';
|
||||
|
||||
if (!$error && $backtopage) {
|
||||
header("Location: ".$backtopage);
|
||||
@@ -1022,7 +1022,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Moral");
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("MemberNature")."</td><td>\n";
|
||||
print $form->selectarray("morphy", $morphys, (GETPOST('morphy', 'alpha') ?GETPOST('morphy', 'alpha') : $object->morphy), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print $form->selectarray("morphy", $morphys, (GETPOST('morphy', 'alpha') ? GETPOST('morphy', 'alpha') : $object->morphy), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print "</td>\n";
|
||||
|
||||
// Company
|
||||
@@ -1058,7 +1058,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Address
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET('address') ?GETPOST('address', 'alphanohtml') : $soc->address).'</textarea>';
|
||||
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET('address') ? GETPOST('address', 'alphanohtml') : $soc->address).'</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Zip / Town
|
||||
@@ -1154,11 +1154,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
if ($action == 'edit') {
|
||||
$res = $object->fetch($id);
|
||||
if ($res < 0) {
|
||||
dol_print_error($db, $object->error); exit;
|
||||
dol_print_error($db, $object->error);
|
||||
exit;
|
||||
}
|
||||
$res = $object->fetch_optionals();
|
||||
if ($res < 0) {
|
||||
dol_print_error($db); exit;
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$adht = new AdherentType($db);
|
||||
@@ -1307,7 +1309,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Website
|
||||
print '<tr><td>'.$form->editfieldkey('Web', 'member_url', GETPOST('member_url', 'alpha'), $object, 0).'</td>';
|
||||
print '<td>'.img_picto('', 'globe', 'class="pictofixedwidth"').'<input type="text" name="member_url" id="member_url" class="maxwidth200onsmartphone maxwidth500 widthcentpercentminusx " value="'.(GETPOSTISSET('member_url') ?GETPOST('member_url', 'alpha') : $object->url).'"></td></tr>';
|
||||
print '<td>'.img_picto('', 'globe', 'class="pictofixedwidth"').'<input type="text" name="member_url" id="member_url" class="maxwidth200onsmartphone maxwidth500 widthcentpercentminusx " value="'.(GETPOSTISSET('member_url') ? GETPOST('member_url', 'alpha') : $object->url).'"></td></tr>';
|
||||
|
||||
// Address
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td>';
|
||||
@@ -1356,7 +1358,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
if (!$value['active']) {
|
||||
break;
|
||||
}
|
||||
print '<tr><td>'.$langs->trans($value['label']).'</td><td><input type="text" name="'.$key.'" class="minwidth100" value="'.(GETPOSTISSET($key) ? GETPOST($key, 'alphanohtml') : (isset($object->socialnetworks[$key])? $object->socialnetworks[$key] : null)).'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans($value['label']).'</td><td><input type="text" name="'.$key.'" class="minwidth100" value="'.(GETPOSTISSET($key) ? GETPOST($key, 'alphanohtml') : (isset($object->socialnetworks[$key]) ? $object->socialnetworks[$key] : null)).'"></td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1435,17 +1437,20 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
if ($id > 0 && $action != 'edit') {
|
||||
$res = $object->fetch($id);
|
||||
if ($res < 0) {
|
||||
dol_print_error($db, $object->error); exit;
|
||||
dol_print_error($db, $object->error);
|
||||
exit;
|
||||
}
|
||||
$res = $object->fetch_optionals();
|
||||
if ($res < 0) {
|
||||
dol_print_error($db); exit;
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$adht = new AdherentType($db);
|
||||
$res = $adht->fetch($object->typeid);
|
||||
if ($res < 0) {
|
||||
dol_print_error($db); exit;
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -306,7 +306,7 @@ 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') ? '' : $conf->global->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>';
|
||||
|
||||
@@ -634,7 +634,7 @@ class Adherent extends CommonObject
|
||||
try {
|
||||
require_once $modfile;
|
||||
$modname = getDolGlobalString('MEMBER_CODEMEMBER_ADDON');
|
||||
$modCodeMember = new $modname;
|
||||
$modCodeMember = new $modname();
|
||||
$this->ref = $modCodeMember->getNextValue($mysoc, $this);
|
||||
} catch (Exception $e) {
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
@@ -728,7 +728,7 @@ class Adherent extends CommonObject
|
||||
$this->state_id = ($this->state_id > 0 ? $this->state_id : $this->state_id);
|
||||
$this->note_public = ($this->note_public ? $this->note_public : $this->note_public);
|
||||
$this->note_private = ($this->note_private ? $this->note_private : $this->note_private);
|
||||
$this->url = $this->url ?clean_url($this->url, 0) : '';
|
||||
$this->url = $this->url ? clean_url($this->url, 0) : '';
|
||||
$this->setUpperOrLowerCase();
|
||||
// Check parameters
|
||||
if (getDolGlobalString('ADHERENT_MAIL_REQUIRED') && !isValidEMail($this->email)) {
|
||||
@@ -2328,7 +2328,7 @@ class Adherent extends CommonObject
|
||||
$label = $langs->trans("ShowUser");
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
|
||||
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
|
||||
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
|
||||
}
|
||||
|
||||
@@ -3229,7 +3229,7 @@ class Adherent extends CommonObject
|
||||
return $nbko;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Return clicable link of object (with eventually picto)
|
||||
*
|
||||
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
|
||||
|
||||
@@ -276,7 +276,7 @@ class AdherentType extends CommonObject
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Delete a language for this member type
|
||||
*
|
||||
* @param string $langtodelete Language code to delete
|
||||
@@ -401,7 +401,7 @@ class AdherentType extends CommonObject
|
||||
$sql .= "caneditamount = ".((int) $this->caneditamount).",";
|
||||
$sql .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',";
|
||||
$sql .= "note = '".$this->db->escape($this->note_public)."',";
|
||||
$sql .= "vote = ".(integer) $this->db->escape($this->vote).",";
|
||||
$sql .= "vote = ".(int) $this->db->escape($this->vote).",";
|
||||
$sql .= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
|
||||
$sql .= " WHERE rowid =".((int) $this->id);
|
||||
|
||||
@@ -469,7 +469,9 @@ class AdherentType extends CommonObject
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('MEMBER_TYPE_DELETE', $user);
|
||||
if ($result < 0) {
|
||||
$error++; $this->db->rollback(); return -2;
|
||||
$error++;
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
// End call triggers
|
||||
|
||||
@@ -765,7 +767,7 @@ class AdherentType extends CommonObject
|
||||
}
|
||||
}
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
$linkstart .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
|
||||
$linkstart .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
|
||||
$linkstart .= $dataparams.' class="'.$classfortooltip.'">';
|
||||
|
||||
$linkend = '</a>';
|
||||
@@ -775,7 +777,7 @@ class AdherentType extends CommonObject
|
||||
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), (' class="'.(($withpicto != 2) ? 'paddingright' : '').'"'), 0, 0, $notooltip ? 0 : 1);
|
||||
}
|
||||
if ($withpicto != 2) {
|
||||
$result .= ($maxlen ?dol_trunc($this->label, $maxlen) : $this->label);
|
||||
$result .= ($maxlen ? dol_trunc($this->label, $maxlen) : $this->label);
|
||||
}
|
||||
$result .= $linkend;
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ if ($id > 0) {
|
||||
$result = $membert->fetch($object->typeid);
|
||||
if ($result > 0) {
|
||||
// Build file list
|
||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
|
||||
$totalsize = 0;
|
||||
foreach ($filearray as $key => $file) {
|
||||
$totalsize += $file['size'];
|
||||
|
||||
@@ -47,7 +47,7 @@ $show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'aZ');
|
||||
$mode = GETPOST('mode', 'alpha');
|
||||
@@ -91,14 +91,14 @@ if ($statut != '') {
|
||||
$search_status = $statut; // For backward compatibility
|
||||
}
|
||||
|
||||
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
|
||||
if ($search_status < -2) {
|
||||
$search_status = '';
|
||||
}
|
||||
|
||||
// Pagination parameters
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
|
||||
@@ -129,7 +129,9 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
$object->fields['fk_member']['visible'] = 0;
|
||||
if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) $object->fields['reason_decline_or_cancel']['visible'] = 1;
|
||||
if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) {
|
||||
$object->fields['reason_decline_or_cancel']['visible'] = 1;
|
||||
}
|
||||
$object->fields['note_public']['visible'] = 1;
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ $graphwidth = DolGraph::getDefaultGraphSizeForStats('width', 700);
|
||||
$mapratio = 0.5;
|
||||
$graphheight = round($graphwidth * $mapratio);
|
||||
|
||||
$mode = GETPOST('mode') ?GETPOST('mode') : '';
|
||||
$mode = GETPOST('mode') ? GETPOST('mode') : '';
|
||||
|
||||
|
||||
// Security check
|
||||
@@ -77,7 +77,7 @@ if ($mode == 'memberbyregion') {
|
||||
|
||||
llxHeader('', $title, '', '', 0, 0, $arrayjs);
|
||||
|
||||
print load_fiche_titre($title, '', $memberstatic->picto);
|
||||
print load_fiche_titre($title, '', $memberstatic->picto);
|
||||
|
||||
//dol_mkdir($dir);
|
||||
|
||||
@@ -173,7 +173,7 @@ if ($mode) {
|
||||
if ($mode == 'memberbyregion') { //+
|
||||
$data[] = array(
|
||||
'label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label :'<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>')),
|
||||
'label2'=>($obj->label2 ? $obj->label2 : '<span class="opacitymedium">'.$langs->trans("Unknown").'</span>'),
|
||||
'nb'=>$obj->nb,
|
||||
'lastdate'=>$db->jdate($obj->lastdate),
|
||||
|
||||
@@ -50,7 +50,7 @@ $typeid = (int) GETPOST('typeid', 'int');
|
||||
$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
|
||||
|
||||
if (!$user->hasRight('adherent', 'cotisation', 'lire')) {
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$permissionnote = $user->hasRight('adherent', 'cotisation', 'creer'); // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
@@ -43,7 +43,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
|
||||
|
||||
$statut = (GETPOSTISSET("statut") ?GETPOST("statut", "alpha") : 1);
|
||||
$statut = (GETPOSTISSET("statut") ? GETPOST("statut", "alpha") : 1);
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_type = GETPOST('search_type', 'alpha');
|
||||
$search_lastname = GETPOST('search_lastname', 'alpha');
|
||||
|
||||
@@ -200,7 +200,7 @@ if ($action == 'update' && $user->hasRight('adherent', 'configurer')) {
|
||||
$object->note_public = trim($comment);
|
||||
$object->note_private = '';
|
||||
$object->mail_valid = trim($mail_valid);
|
||||
$object->vote = (boolean) trim($vote);
|
||||
$object->vote = (bool) trim($vote);
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
@@ -534,7 +534,7 @@ if ($rowid > 0) {
|
||||
|
||||
// Amount
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Amount").'</td><td>';
|
||||
print ((is_null($object->amount) || $object->amount === '') ? '' : '<span class="amount">'.price($object->amount).'</span>');
|
||||
print((is_null($object->amount) || $object->amount === '') ? '' : '<span class="amount">'.price($object->amount).'</span>');
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmount")).'</td><td>';
|
||||
@@ -551,7 +551,7 @@ if ($rowid > 0) {
|
||||
} elseif ($object->duration_value > 0) {
|
||||
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year"));
|
||||
}
|
||||
print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." ";
|
||||
print(!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." ";
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
@@ -972,7 +972,7 @@ if ($rowid > 0) {
|
||||
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>';
|
||||
print '<input name="amount" size="5" value="';
|
||||
print ((is_null($object->amount) || $object->amount === '') ? '' : price($object->amount));
|
||||
print((is_null($object->amount) || $object->amount === '') ? '' : price($object->amount));
|
||||
print '">';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ if ($action == 'edit') {
|
||||
$s = picto_from_langcode($key);
|
||||
print '<br>';
|
||||
print '<div class="inline-block marginbottomonly">';
|
||||
print ($s ? $s.' ' : '').'<b>'.$langs->trans('Language_'.$key).':</b>';
|
||||
print($s ? $s.' ' : '').'<b>'.$langs->trans('Language_'.$key).':</b>';
|
||||
print '</div>';
|
||||
print '<div class="inline-block marginbottomonly floatright">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=delete&token='.newToken().'&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom"')."</a><br>";
|
||||
@@ -242,7 +242,7 @@ if ($action == 'edit') {
|
||||
foreach ($object->multilangs as $key => $value) {
|
||||
$s = picto_from_langcode($key);
|
||||
print '<div class="inline-block marginbottomonly">';
|
||||
print ($s ? $s.' ' : '').'<b>'.$langs->trans('Language_'.$key).':</b>';
|
||||
print($s ? $s.' ' : '').'<b>'.$langs->trans('Language_'.$key).':</b>';
|
||||
print '</div>';
|
||||
print '<div class="inline-block marginbottomonly floatright">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=delete&token='.newToken().'&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom"').'</a>';
|
||||
|
||||
@@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminaccoutant'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'adminaccoutant'; // To manage different context of search
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'companies'));
|
||||
@@ -54,19 +54,19 @@ if ($reshook < 0) {
|
||||
|
||||
if (($action == 'update' && !GETPOST("cancel", 'alpha'))
|
||||
|| ($action == 'updateedit')) {
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NAME", GETPOST("nom", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ADDRESS", GETPOST("address", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_TOWN", GETPOST("town", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ZIP", GETPOST("zipcode", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_STATE", GETPOST("state_id", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_REGION", GETPOST("region_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_COUNTRY", GETPOST('country_id', 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_PHONE", GETPOST("tel", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_FAX", GETPOST("fax", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_MAIL", GETPOST("mail", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_WEB", GETPOST("web", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_CODE", GETPOST("code", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NOTE", GETPOST("note", 'restricthtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NAME", GETPOST("nom", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ADDRESS", GETPOST("address", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_TOWN", GETPOST("town", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ZIP", GETPOST("zipcode", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_STATE", GETPOST("state_id", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_REGION", GETPOST("region_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_COUNTRY", GETPOST('country_id', 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_PHONE", GETPOST("tel", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_FAX", GETPOST("fax", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_MAIL", GETPOST("mail", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_WEB", GETPOST("web", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_CODE", GETPOST("code", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NOTE", GETPOST("note", 'restricthtml'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if ($action != 'updateedit' && !$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
|
||||
@@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminaccoutant'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'adminaccoutant'; // To manage different context of search
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'companies', 'accountancy'));
|
||||
|
||||
@@ -91,7 +91,7 @@ if ($action == "save" && empty($cancel)) {
|
||||
foreach ($triggers as $trigger) {
|
||||
$keyparam = 'MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
||||
if ($search_event === '' || preg_match('/'.preg_quote($search_event, '/').'/i', $keyparam)) {
|
||||
$res = dolibarr_set_const($db, $keyparam, (GETPOST($keyparam, 'alpha') ?GETPOST($keyparam, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, $keyparam, (GETPOST($keyparam, 'alpha') ? GETPOST($keyparam, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,8 @@ if (preg_match('/set_(.*)/', $action, $reg)) {
|
||||
$disableext = GETPOST('AGENDA_DISABLE_EXT', 'alpha');
|
||||
$res = dolibarr_set_const($db, 'AGENDA_DISABLE_EXT', $disableext, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$i = 1; $errorsaved = 0;
|
||||
$i = 1;
|
||||
$errorsaved = 0;
|
||||
|
||||
// Save agendas
|
||||
while ($i <= $MAXAGENDA) {
|
||||
@@ -204,7 +205,11 @@ print "<br>\n";
|
||||
|
||||
|
||||
$selectedvalue = getDolGlobalInt('AGENDA_DISABLE_EXT');
|
||||
if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1;
|
||||
if ($selectedvalue==1) {
|
||||
$selectedvalue=0;
|
||||
} else {
|
||||
$selectedvalue=1;
|
||||
}
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
|
||||
@@ -121,7 +121,9 @@ if ($action == 'set') {
|
||||
$commande->thirdparty = $specimenthirdparty;
|
||||
|
||||
// Search template files
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$file = '';
|
||||
$classname = '';
|
||||
$filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0);
|
||||
@@ -251,7 +253,7 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print "<td>";
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print(empty($module->name) ? $name : $module->name);
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.'/'.$file;
|
||||
|
||||
@@ -84,7 +84,9 @@ if ($action == 'set') {
|
||||
$commande->thirdparty = $specimenthirdparty;
|
||||
|
||||
// Search template files
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$file = '';
|
||||
$classname = '';
|
||||
$filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0);
|
||||
|
||||
@@ -177,37 +177,37 @@ $getentity = ($conf->entity > 1 ? "&entity=".$conf->entity : "");
|
||||
// Show message
|
||||
$message = '';
|
||||
|
||||
$urlvcal = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank" rel="noopener noreferrer">';
|
||||
$urlvcal .= $urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$urlvcal = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ? urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank" rel="noopener noreferrer">';
|
||||
$urlvcal .= $urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ? urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlvcal, '<span class="opacitymedium">'.$langs->trans("WebCalUrlForVCalExport", 'vcal', '').'</span>');
|
||||
$message .= '<div class="urllink">';
|
||||
$message .= '<input type="text" id="onlinepaymenturl1" class="quatrevingtpercent" value="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">';
|
||||
$message .= '<input type="text" id="onlinepaymenturl1" class="quatrevingtpercent" value="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ? urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">';
|
||||
if (getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY')) {
|
||||
$message .= ' <a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">'.img_picto('', 'download').'</a>';
|
||||
$message .= ' <a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ? urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">'.img_picto('', 'download').'</a>';
|
||||
}
|
||||
$message .= '</div>';
|
||||
$message .= ajax_autoselect('onlinepaymenturl1');
|
||||
$message .= '<br>';
|
||||
|
||||
$urlical = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank" rel="noopener noreferrer">';
|
||||
$urlical .= $urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$urlical = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ? urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank" rel="noopener noreferrer">';
|
||||
$urlical .= $urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ? urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlical, '<span class="opacitymedium">'.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', '').'</span>');
|
||||
$message .= '<div class="urllink">';
|
||||
$message .= '<input type="text" id="onlinepaymenturl2" class="quatrevingtpercent" value="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">';
|
||||
$message .= '<input type="text" id="onlinepaymenturl2" class="quatrevingtpercent" value="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ? urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">';
|
||||
if (getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY')) {
|
||||
$message .= ' <a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">'.img_picto('', 'download').'</a>';
|
||||
$message .= ' <a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ? urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">'.img_picto('', 'download').'</a>';
|
||||
}
|
||||
$message .= '</div>';
|
||||
$message .= ajax_autoselect('onlinepaymenturl2');
|
||||
$message .= '<br>';
|
||||
|
||||
$urlrss = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank" rel="noopener noreferrer">';
|
||||
$urlrss .= $urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$urlrss = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ? urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank" rel="noopener noreferrer">';
|
||||
$urlrss .= $urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ? urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlrss, '<span class="opacitymedium">'.$langs->trans("WebCalUrlForVCalExport", 'rss', '').'</span>');
|
||||
$message .= '<div class="urllink">';
|
||||
$message .= '<input type="text" id="onlinepaymenturl3" class="quatrevingtpercent" value="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">';
|
||||
$message .= '<input type="text" id="onlinepaymenturl3" class="quatrevingtpercent" value="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ? urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">';
|
||||
if (getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY')) {
|
||||
$message .= ' <a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">'.img_picto('', 'download').'</a>';
|
||||
$message .= ' <a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ? urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'">'.img_picto('', 'download').'</a>';
|
||||
}
|
||||
$message .= '</div>';
|
||||
$message .= ajax_autoselect('onlinepaymenturl3');
|
||||
|
||||
@@ -88,7 +88,8 @@ if ($action == 'setbankcolorizemovement') {
|
||||
if ($actionsave) {
|
||||
$db->begin();
|
||||
|
||||
$i = 1; $errorsaved = 0;
|
||||
$i = 1;
|
||||
$errorsaved = 0;
|
||||
$error = 0;
|
||||
|
||||
// Save colors
|
||||
@@ -445,7 +446,7 @@ if (getDolGlobalInt('BANK_COLORIZE_MOVEMENT')) {
|
||||
print '<td colspan="4" width="180" class="nowrap">'.$langs->trans("BankColorizeMovementName".$key)."</td>";
|
||||
// Color
|
||||
print '<td class="nowrap right">';
|
||||
print $formother->selectColor((GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) ?GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) : $conf->global->$color), "BANK_COLORIZE_MOVEMENT_COLOR".$key, 'bankmovementcolorconfig', 1, '', 'right hideifnotset');
|
||||
print $formother->selectColor((GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) ? GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) : $conf->global->$color), "BANK_COLORIZE_MOVEMENT_COLOR".$key, 'bankmovementcolorconfig', 1, '', 'right hideifnotset');
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
$i++;
|
||||
|
||||
@@ -74,7 +74,9 @@ if ($action == 'updateMask') {
|
||||
$bom->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$file = '';
|
||||
$classname = '';
|
||||
$filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$file = dol_buildpath($reldir."core/modules/bom/doc/pdf_".$modele.".modules.php", 0);
|
||||
@@ -354,7 +356,7 @@ foreach ($dirmodels as $reldir) {
|
||||
|
||||
if ($modulequalified) {
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print(empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module, 'info')) {
|
||||
print $module->info($langs);
|
||||
|
||||
@@ -348,7 +348,7 @@ foreach ($boxtoadd as $box) {
|
||||
$langs->load("errors");
|
||||
print $langs->trans("WarningUsingThisBoxSlowDown");
|
||||
} else {
|
||||
print ($box->note ? $box->note : ' ');
|
||||
print($box->note ? $box->note : ' ');
|
||||
}
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
@@ -404,7 +404,7 @@ foreach ($boxactivated as $key => $box) {
|
||||
if ($box->note == '(WarningUsingThisBoxSlowDown)') {
|
||||
print img_warning('', 0).' '.$langs->trans("WarningUsingThisBoxSlowDown");
|
||||
} else {
|
||||
print ($box->note ? $box->note : ' ');
|
||||
print($box->note ? $box->note : ' ');
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
@@ -415,8 +415,8 @@ foreach ($boxactivated as $key => $box) {
|
||||
$hasprevious = ($key != 0);
|
||||
print '<td class="center">'.($key + 1).'</td>';
|
||||
print '<td class="center nowraponall">';
|
||||
print ($hasnext ? '<a class="reposition" href="boxes.php?action=switch&token='.newToken().'&switchfrom='.$box->rowid.'&switchto='.$boxactivated[$key + 1]->rowid.'">'.img_down().'</a> ' : '');
|
||||
print ($hasprevious ? '<a class="reposition" href="boxes.php?action=switch&token='.newToken().'&switchfrom='.$box->rowid.'&switchto='.$boxactivated[$key - 1]->rowid.'">'.img_up().'</a>' : '');
|
||||
print($hasnext ? '<a class="reposition" href="boxes.php?action=switch&token='.newToken().'&switchfrom='.$box->rowid.'&switchto='.$boxactivated[$key + 1]->rowid.'">'.img_down().'</a> ' : '');
|
||||
print($hasprevious ? '<a class="reposition" href="boxes.php?action=switch&token='.newToken().'&switchfrom='.$box->rowid.'&switchto='.$boxactivated[$key - 1]->rowid.'">'.img_up().'</a>' : '');
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print '<a class="reposition" href="boxes.php?rowid='.$box->rowid.'&action=delete&token='.newToken().'">'.img_delete().'</a>';
|
||||
|
||||
@@ -162,7 +162,7 @@ foreach ($dirmodels as $reldir) {
|
||||
|
||||
if ($module->isEnabled()) {
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print(empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
|
||||
print $module->info($langs);
|
||||
|
||||
@@ -84,7 +84,9 @@ if ($action == 'updateMask') {
|
||||
$commande->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$file = '';
|
||||
$classname = '';
|
||||
$filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$file = dol_buildpath($reldir."core/modules/commande/doc/pdf_".$modele.".modules.php", 0);
|
||||
@@ -437,7 +439,7 @@ foreach ($dirmodels as $reldir) {
|
||||
|
||||
if ($modulequalified) {
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print(empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module, 'info')) {
|
||||
print $module->info($langs);
|
||||
|
||||
@@ -40,7 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'admincompany'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'admincompany'; // To manage different context of search
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'companies', 'bills'));
|
||||
|
||||
@@ -33,7 +33,7 @@ require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'admincompany'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'admincompany'; // To manage different context of search
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'companies'));
|
||||
|
||||
@@ -41,7 +41,7 @@ $constname = GETPOST('constname', 'alphanohtml');
|
||||
$constvalue = GETPOST('constvalue', 'restricthtml'); // We should be able to send everything here
|
||||
$constnote = GETPOST('constnote', 'alpha');
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
|
||||
@@ -80,7 +80,9 @@ if ($action == 'updateMask') {
|
||||
$contract->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$file = '';
|
||||
$classname = '';
|
||||
$filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$file = dol_buildpath($reldir."core/modules/contract/doc/pdf_".$modele.".modules.php", 0);
|
||||
@@ -386,7 +388,7 @@ foreach ($dirmodels as $reldir) {
|
||||
|
||||
if ($modulequalified) {
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print(empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module, 'info')) {
|
||||
print $module->info($langs);
|
||||
|
||||
@@ -46,7 +46,7 @@ $optioncss = GETPOST('optionscss', 'alphanohtml');
|
||||
|
||||
$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'createform'; // 'createform', 'filters', 'sortorder', 'focus'
|
||||
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -83,7 +83,8 @@ $object = new DefaultValues($db);
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && !empty($massaction) && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
@@ -365,21 +366,30 @@ if (!is_array($result) && $result < 0) {
|
||||
|
||||
// Page
|
||||
print '<td>';
|
||||
if ($action != 'edit' || GETPOST('rowid', 'int') != $defaultvalue->id) print $defaultvalue->page;
|
||||
else print '<input type="text" name="urlpage" value="'.dol_escape_htmltag($defaultvalue->page).'">';
|
||||
if ($action != 'edit' || GETPOST('rowid', 'int') != $defaultvalue->id) {
|
||||
print $defaultvalue->page;
|
||||
} else {
|
||||
print '<input type="text" name="urlpage" value="'.dol_escape_htmltag($defaultvalue->page).'">';
|
||||
}
|
||||
print '</td>'."\n";
|
||||
|
||||
// Field
|
||||
print '<td>';
|
||||
if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) print $defaultvalue->param;
|
||||
else print '<input type="text" name="key" value="'.dol_escape_htmltag($defaultvalue->param).'">';
|
||||
if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) {
|
||||
print $defaultvalue->param;
|
||||
} else {
|
||||
print '<input type="text" name="key" value="'.dol_escape_htmltag($defaultvalue->param).'">';
|
||||
}
|
||||
print '</td>'."\n";
|
||||
|
||||
// Value
|
||||
if ($mode != 'focus' && $mode != 'mandatory') {
|
||||
print '<td>';
|
||||
if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) print dol_escape_htmltag($defaultvalue->value);
|
||||
else print '<input type="text" name="value" value="'.dol_escape_htmltag($defaultvalue->value).'">';
|
||||
if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) {
|
||||
print dol_escape_htmltag($defaultvalue->value);
|
||||
} else {
|
||||
print '<input type="text" name="value" value="'.dol_escape_htmltag($defaultvalue->value).'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@@ -392,7 +402,7 @@ if (!is_array($result) && $result < 0) {
|
||||
|
||||
// Actions
|
||||
print '<td class="center">';
|
||||
if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) {
|
||||
if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) {
|
||||
print '<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$defaultvalue->id.'&entity='.$defaultvalue->entity.'&mode='.$mode.'&action=edit&token='.newToken().'">'.img_edit().'</a>';
|
||||
print '<a class="marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$defaultvalue->id.'&entity='.$defaultvalue->entity.'&mode='.$mode.'&action=delete&token='.newToken().'">'.img_delete().'</a>';
|
||||
} else {
|
||||
|
||||
@@ -331,7 +331,8 @@ if (!getDolGlobalString('MAIN_DISABLE_METEO') || $conf->global->MAIN_DISABLE_MET
|
||||
if (getDolGlobalString('MAIN_METEO_LEVEL3')) {
|
||||
$level3 = $conf->global->MAIN_METEO_LEVEL3;
|
||||
}
|
||||
$text = ''; $options = 'class="valignmiddle" height="60px"';
|
||||
$text = '';
|
||||
$options = 'class="valignmiddle" height="60px"';
|
||||
|
||||
|
||||
if ($action == 'edit') {
|
||||
@@ -373,9 +374,7 @@ if (!getDolGlobalString('MAIN_DISABLE_METEO') || $conf->global->MAIN_DISABLE_MET
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
?>
|
||||
print '</div>'; ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
@@ -129,7 +129,9 @@ if ($action == 'specimen') {
|
||||
$sending->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$file = '';
|
||||
$classname = '';
|
||||
$filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$file = dol_buildpath($reldir."core/modules/delivery/doc/pdf_".$modele.".modules.php", 0);
|
||||
@@ -254,7 +256,7 @@ if (getDolGlobalString('MAIN_SUBMODULE_DELIVERY')) {
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
$module = new $file();
|
||||
|
||||
if ($module->isEnabled()) {
|
||||
// Show modules according to features level
|
||||
@@ -396,7 +398,7 @@ if (getDolGlobalString('MAIN_SUBMODULE_DELIVERY')) {
|
||||
|
||||
if ($modulequalified) {
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print(empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module, 'info')) {
|
||||
print $module->info($langs);
|
||||
|
||||
@@ -47,7 +47,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("errors", "admin", "main", "companies", "resource", "holiday", "accountancy", "hrm", "orders", "contracts", "projects", "propal", "bills", "interventions", "ticket"));
|
||||
|
||||
$action = GETPOST('action', 'alpha') ?GETPOST('action', 'alpha') : 'view';
|
||||
$action = GETPOST('action', 'alpha') ? GETPOST('action', 'alpha') : 'view';
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'alpha');
|
||||
@@ -62,7 +62,7 @@ $actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"')
|
||||
|
||||
// Load variable for pagination
|
||||
$listoffset = GETPOST('listoffset');
|
||||
$listlimit = GETPOST('listlimit') > 0 ?GETPOST('listlimit') : 1000; // To avoid too long dictionaries
|
||||
$listlimit = GETPOST('listlimit') > 0 ? GETPOST('listlimit') : 1000; // To avoid too long dictionaries
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -761,7 +761,8 @@ if (empty($reshook)) {
|
||||
continue; // For a column name 'sortorder', we use the field name 'position'
|
||||
}
|
||||
if ((!GETPOSTISSET($value) || GETPOST($value) == '')
|
||||
&& (!in_array($value, array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto', 'deposit_percent')) // Fields that are not mandatory
|
||||
&& (
|
||||
!in_array($value, array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto', 'deposit_percent')) // Fields that are not mandatory
|
||||
&& ($id != 10 || ($value != 'code' && $value != 'note')) // Field code and note is not mandatory for dictionary table 10
|
||||
)
|
||||
) {
|
||||
@@ -1390,7 +1391,8 @@ if ($id > 0) {
|
||||
$class = '';
|
||||
|
||||
if ($value == 'pos') {
|
||||
$valuetoshow = $langs->trans("Position"); $class = 'right';
|
||||
$valuetoshow = $langs->trans("Position");
|
||||
$class = 'right';
|
||||
}
|
||||
if ($value == 'source') {
|
||||
$valuetoshow = $langs->trans("Contact");
|
||||
@@ -1407,16 +1409,22 @@ if ($id > 0) {
|
||||
$class = 'center';
|
||||
}
|
||||
if ($value == 'localtax1_type') {
|
||||
$valuetoshow = $langs->trans("UseLocalTax")." 2"; $class = "center"; $sortable = 0;
|
||||
$valuetoshow = $langs->trans("UseLocalTax")." 2";
|
||||
$class = "center";
|
||||
$sortable = 0;
|
||||
}
|
||||
if ($value == 'localtax1') {
|
||||
$valuetoshow = $langs->trans("RateOfTaxN", '2'); $class = "center";
|
||||
$valuetoshow = $langs->trans("RateOfTaxN", '2');
|
||||
$class = "center";
|
||||
}
|
||||
if ($value == 'localtax2_type') {
|
||||
$valuetoshow = $langs->trans("UseLocalTax")." 3"; $class = "center"; $sortable = 0;
|
||||
$valuetoshow = $langs->trans("UseLocalTax")." 3";
|
||||
$class = "center";
|
||||
$sortable = 0;
|
||||
}
|
||||
if ($value == 'localtax2') {
|
||||
$valuetoshow = $langs->trans("RateOfTaxN", '3'); $class = "center";
|
||||
$valuetoshow = $langs->trans("RateOfTaxN", '3');
|
||||
$class = "center";
|
||||
}
|
||||
if ($value == 'organization') {
|
||||
$valuetoshow = $langs->trans("Organization");
|
||||
@@ -1432,7 +1440,8 @@ if ($id > 0) {
|
||||
}
|
||||
}
|
||||
if ($value == 'code') {
|
||||
$valuetoshow = $langs->trans("Code"); $class = 'maxwidth100';
|
||||
$valuetoshow = $langs->trans("Code");
|
||||
$class = 'maxwidth100';
|
||||
}
|
||||
if ($value == 'libelle' || $value == 'label') {
|
||||
$valuetoshow = $form->textwithtooltip($langs->trans("Label"), $langs->trans("LabelUsedByDefault"), 2, 1, img_help(1, ''));
|
||||
@@ -1452,14 +1461,16 @@ if ($id > 0) {
|
||||
$valuetoshow = $langs->trans("Country");
|
||||
}
|
||||
if ($value == 'recuperableonly') {
|
||||
$valuetoshow = $langs->trans("NPR"); $class = "center";
|
||||
$valuetoshow = $langs->trans("NPR");
|
||||
$class = "center";
|
||||
}
|
||||
if ($value == 'nbjour') {
|
||||
$valuetoshow = $langs->trans("NbOfDays");
|
||||
$class = 'right';
|
||||
}
|
||||
if ($value == 'type_cdr') {
|
||||
$valuetoshow = $langs->trans("AtEndOfMonth"); $class = "center";
|
||||
$valuetoshow = $langs->trans("AtEndOfMonth");
|
||||
$class = "center";
|
||||
}
|
||||
if ($value == 'decalage') {
|
||||
$valuetoshow = $langs->trans("Offset");
|
||||
@@ -1506,7 +1517,8 @@ if ($id > 0) {
|
||||
$valuetoshow = $langs->trans("ShortLabel");
|
||||
}
|
||||
if ($value == 'fk_parent') {
|
||||
$valuetoshow = $langs->trans("ParentID"); $class = 'center';
|
||||
$valuetoshow = $langs->trans("ParentID");
|
||||
$class = 'center';
|
||||
}
|
||||
if ($value == 'range_account') {
|
||||
$valuetoshow = $langs->trans("Range");
|
||||
@@ -1572,13 +1584,15 @@ if ($id > 0) {
|
||||
$valuetoshow = $langs->trans('TypeOfRevenueStamp');
|
||||
}
|
||||
if ($value == 'use_default') {
|
||||
$valuetoshow = $langs->trans('Default'); $class = 'center';
|
||||
$valuetoshow = $langs->trans('Default');
|
||||
$class = 'center';
|
||||
}
|
||||
if ($value == 'unit_type') {
|
||||
$valuetoshow = $langs->trans('TypeOfUnit');
|
||||
}
|
||||
if ($value == 'public' && $tablib[$id] == 'TicketDictCategory') {
|
||||
$valuetoshow = $langs->trans('TicketGroupIsPublic'); $class = 'center';
|
||||
$valuetoshow = $langs->trans('TicketGroupIsPublic');
|
||||
$class = 'center';
|
||||
}
|
||||
if ($value == 'block_if_negative') {
|
||||
$valuetoshow = $langs->trans('BlockHolidayIfNegative');
|
||||
@@ -1647,7 +1661,8 @@ if ($id > 0) {
|
||||
$tmpaction = 'create';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
if ($id == 3) {
|
||||
unset($fieldlist[2]); // Remove field ??? if dictionary Regions
|
||||
@@ -1823,16 +1838,24 @@ if ($id > 0) {
|
||||
}
|
||||
|
||||
if ($value == 'localtax1_type') {
|
||||
$valuetoshow = $langs->trans("UseLocalTax")." 2"; $cssprefix = "center "; $sortable = 0;
|
||||
$valuetoshow = $langs->trans("UseLocalTax")." 2";
|
||||
$cssprefix = "center ";
|
||||
$sortable = 0;
|
||||
}
|
||||
if ($value == 'localtax1') {
|
||||
$valuetoshow = $langs->trans("RateOfTaxN", '2'); $cssprefix = "center "; $sortable = 0;
|
||||
$valuetoshow = $langs->trans("RateOfTaxN", '2');
|
||||
$cssprefix = "center ";
|
||||
$sortable = 0;
|
||||
}
|
||||
if ($value == 'localtax2_type') {
|
||||
$valuetoshow = $langs->trans("UseLocalTax")." 3"; $cssprefix = "center "; $sortable = 0;
|
||||
$valuetoshow = $langs->trans("UseLocalTax")." 3";
|
||||
$cssprefix = "center ";
|
||||
$sortable = 0;
|
||||
}
|
||||
if ($value == 'localtax2') {
|
||||
$valuetoshow = $langs->trans("RateOfTaxN", '3'); $cssprefix = "center "; $sortable = 0;
|
||||
$valuetoshow = $langs->trans("RateOfTaxN", '3');
|
||||
$cssprefix = "center ";
|
||||
$sortable = 0;
|
||||
}
|
||||
if ($value == 'organization') {
|
||||
$valuetoshow = $langs->trans("Organization");
|
||||
@@ -1847,7 +1870,8 @@ if ($id > 0) {
|
||||
$valuetoshow = $langs->trans("Code");
|
||||
}
|
||||
if (in_array($value, array('pos', 'position'))) {
|
||||
$valuetoshow = $langs->trans("Position"); $cssprefix = 'right ';
|
||||
$valuetoshow = $langs->trans("Position");
|
||||
$cssprefix = 'right ';
|
||||
}
|
||||
if ($value == 'libelle' || $value == 'label') {
|
||||
$valuetoshow = $langs->trans("Label");
|
||||
@@ -1863,14 +1887,16 @@ if ($id > 0) {
|
||||
$valuetoshow = $langs->trans("Country");
|
||||
}
|
||||
if ($value == 'recuperableonly') {
|
||||
$valuetoshow = $langs->trans("NPR"); $cssprefix = "center ";
|
||||
$valuetoshow = $langs->trans("NPR");
|
||||
$cssprefix = "center ";
|
||||
}
|
||||
if ($value == 'nbjour') {
|
||||
$valuetoshow = $langs->trans("NbOfDays");
|
||||
$cssprefix = 'right ';
|
||||
}
|
||||
if ($value == 'type_cdr') {
|
||||
$valuetoshow = $langs->trans("AtEndOfMonth"); $cssprefix = "center ";
|
||||
$valuetoshow = $langs->trans("AtEndOfMonth");
|
||||
$cssprefix = "center ";
|
||||
}
|
||||
if ($value == 'decalage') {
|
||||
$valuetoshow = $langs->trans("Offset");
|
||||
@@ -1889,10 +1915,12 @@ if ($id > 0) {
|
||||
$valuetoshow = $langs->trans("AccountancyCode");
|
||||
}
|
||||
if ($value == 'accountancy_code_sell') {
|
||||
$valuetoshow = $langs->trans("AccountancyCodeSell"); $sortable = 0;
|
||||
$valuetoshow = $langs->trans("AccountancyCodeSell");
|
||||
$sortable = 0;
|
||||
}
|
||||
if ($value == 'accountancy_code_buy') {
|
||||
$valuetoshow = $langs->trans("AccountancyCodeBuy"); $sortable = 0;
|
||||
$valuetoshow = $langs->trans("AccountancyCodeBuy");
|
||||
$sortable = 0;
|
||||
}
|
||||
if ($value == 'fk_pcg_version') {
|
||||
$valuetoshow = $langs->trans("Pcg_version");
|
||||
@@ -1914,7 +1942,8 @@ if ($id > 0) {
|
||||
$valuetoshow = $langs->trans("ShortLabel");
|
||||
}
|
||||
if ($value == 'fk_parent') {
|
||||
$valuetoshow = $langs->trans("ParentID"); $cssprefix = 'center ';
|
||||
$valuetoshow = $langs->trans("ParentID");
|
||||
$cssprefix = 'center ';
|
||||
}
|
||||
if ($value == 'range_account') {
|
||||
$valuetoshow = $langs->trans("Range");
|
||||
@@ -1980,13 +2009,15 @@ if ($id > 0) {
|
||||
$valuetoshow = $langs->trans('TypeOfRevenueStamp');
|
||||
}
|
||||
if ($value == 'use_default') {
|
||||
$valuetoshow = $langs->trans('Default'); $cssprefix = 'center ';
|
||||
$valuetoshow = $langs->trans('Default');
|
||||
$cssprefix = 'center ';
|
||||
}
|
||||
if ($value == 'unit_type') {
|
||||
$valuetoshow = $langs->trans('TypeOfUnit');
|
||||
}
|
||||
if ($value == 'public' && $tablib[$id] == 'TicketDictCategory') {
|
||||
$valuetoshow = $langs->trans('TicketGroupIsPublic'); $cssprefix = 'center ';
|
||||
$valuetoshow = $langs->trans('TicketGroupIsPublic');
|
||||
$cssprefix = 'center ';
|
||||
}
|
||||
if ($value == 'block_if_negative') {
|
||||
$valuetoshow = $langs->trans('BlockHolidayIfNegative');
|
||||
@@ -2050,15 +2081,19 @@ if ($id > 0) {
|
||||
$canbemodified = 1;
|
||||
if (isset($obj->code) && $id != 10 && $id != 42) {
|
||||
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
|
||||
$iserasable = 0; $canbedisabled = 0;
|
||||
$iserasable = 0;
|
||||
$canbedisabled = 0;
|
||||
} elseif ($obj->code == 'RECEP') {
|
||||
$iserasable = 0; $canbedisabled = 0;
|
||||
$iserasable = 0;
|
||||
$canbedisabled = 0;
|
||||
} elseif ($obj->code == 'EF0') {
|
||||
$iserasable = 0; $canbedisabled = 0;
|
||||
$iserasable = 0;
|
||||
$canbedisabled = 0;
|
||||
}
|
||||
}
|
||||
if ($id == 25 && in_array($obj->code, array('banner', 'blogpost', 'menu', 'page', 'other'))) {
|
||||
$iserasable = 0; $canbedisabled = 0;
|
||||
$iserasable = 0;
|
||||
$canbedisabled = 0;
|
||||
if (in_array($obj->code, array('banner'))) {
|
||||
$canbedisabled = 1;
|
||||
}
|
||||
@@ -2067,7 +2102,8 @@ if ($id > 0) {
|
||||
$iserasable = 0;
|
||||
}
|
||||
if (in_array(empty($obj->code) ? '' : $obj->code, array('AC_OTH', 'AC_OTH_AUTO')) || in_array(empty($obj->type) ? '' : $obj->type, array('systemauto'))) {
|
||||
$canbedisabled = 0; $canbedisabled = 0;
|
||||
$canbedisabled = 0;
|
||||
$canbedisabled = 0;
|
||||
}
|
||||
$canbemodified = $iserasable;
|
||||
|
||||
@@ -2086,7 +2122,7 @@ if ($id > 0) {
|
||||
}
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
$url .= '&rowid='.(isset($obj->$rowidcol) ? $obj->$rowidcol : (!empty($obj->code) ? urlencode($obj->code) : ''));
|
||||
$url .= '&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
|
||||
$url .= '&code='.(!empty($obj->code) ? urlencode($obj->code) : '');
|
||||
if (!empty($param)) {
|
||||
$url .= '&'.$param;
|
||||
}
|
||||
@@ -2119,7 +2155,8 @@ if ($id > 0) {
|
||||
$tmpaction = 'edit';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
// Show fields
|
||||
if (empty($reshook)) {
|
||||
@@ -2141,7 +2178,8 @@ if ($id > 0) {
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) {
|
||||
$withentity = null;
|
||||
@@ -2316,7 +2354,7 @@ if ($id > 0) {
|
||||
} elseif ($value == 'block_if_negative') {
|
||||
$valuetoshow = yn($obj->{$value});
|
||||
} elseif ($value == 'icon') {
|
||||
$valuetoshow = $obj->{$value}." ".img_picto("", $obj->{$value});
|
||||
$valuetoshow = $obj->{$value}." ".img_picto("", $obj->{$value});
|
||||
} elseif ($value == 'type_duration') {
|
||||
$TDurationTypes = array('y'=>$langs->trans('Years'), 'm'=>$langs->trans('Month'), 'w'=>$langs->trans('Weeks'), 'd'=>$langs->trans('Days'), 'h'=>$langs->trans('Hours'), 'i'=>$langs->trans('Minutes'));
|
||||
if (!empty($obj->{$value}) && array_key_exists($obj->{$value}, $TDurationTypes)) {
|
||||
@@ -2522,7 +2560,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
}
|
||||
|
||||
if (in_array($value, array('code', 'libelle', 'type')) && $tabname == "c_actioncomm" && isset($obj->$value) && in_array($obj->type, array('system', 'systemauto'))) {
|
||||
$hidden = (!empty($obj->{$value}) ? $obj->{$value}:'');
|
||||
$hidden = (!empty($obj->{$value}) ? $obj->{$value} : '');
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="'. $value .'" value="'.$hidden.'">';
|
||||
print $langs->trans($hidden);
|
||||
@@ -2553,7 +2591,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
$formcompany->select_region($region_id, 'region');
|
||||
print '</td>';
|
||||
} elseif ($value == 'region_id') {
|
||||
$region_id = (!empty($obj->{$value}) ? $obj->{$value}:0);
|
||||
$region_id = (!empty($obj->{$value}) ? $obj->{$value} : 0);
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="'. $value .'" value="'.$region_id.'">';
|
||||
print '</td>';
|
||||
@@ -2569,17 +2607,17 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
$tmparray = $sourceList;
|
||||
}
|
||||
print '<td>';
|
||||
print $form->selectarray($value, $tmparray, (!empty($obj->{$value}) ? $obj->{$value}:''), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth250');
|
||||
print $form->selectarray($value, $tmparray, (!empty($obj->{$value}) ? $obj->{$value} : ''), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth250');
|
||||
print '</td>';
|
||||
} elseif (in_array($value, array('public', 'use_default'))) {
|
||||
// Fields 0/1 with a combo select Yes/No
|
||||
print '<td class="center">';
|
||||
print $form->selectyesno($value, (!empty($obj->{$value}) ? $obj->{$value}:''), 1);
|
||||
print $form->selectyesno($value, (!empty($obj->{$value}) ? $obj->{$value} : ''), 1);
|
||||
print '</td>';
|
||||
} elseif ($value == 'private') {
|
||||
// Fields 'no'/'yes' with a combo select Yes/No
|
||||
print '<td>';
|
||||
print $form->selectyesno("private", (!empty($obj->{$value}) ? $obj->{$value}:''));
|
||||
print $form->selectyesno("private", (!empty($obj->{$value}) ? $obj->{$value} : ''));
|
||||
print '</td>';
|
||||
} elseif ($value == 'type' && $tabname == "c_actioncomm") {
|
||||
$type = (!empty($obj->type) ? $obj->type : 'user'); // Check if type is different of 'user' (external module)
|
||||
@@ -2589,7 +2627,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
} elseif ($value == 'type' && $tabname == 'c_paiement') {
|
||||
print '<td>';
|
||||
$select_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth'));
|
||||
print $form->selectarray($value, $select_list, (!empty($obj->{$value}) ? $obj->{$value}:'2'));
|
||||
print $form->selectarray($value, $select_list, (!empty($obj->{$value}) ? $obj->{$value} : '2'));
|
||||
print '</td>';
|
||||
} elseif ($value == 'recuperableonly' || $value == 'type_cdr' || $value == 'deductible' || $value == 'category_type') {
|
||||
if ($value == 'type_cdr') {
|
||||
@@ -2598,9 +2636,9 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
print '<td>';
|
||||
}
|
||||
if ($value == 'type_cdr') {
|
||||
print $form->selectarray($value, array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (!empty($obj->{$value}) ? $obj->{$value}:''));
|
||||
print $form->selectarray($value, array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (!empty($obj->{$value}) ? $obj->{$value} : ''));
|
||||
} else {
|
||||
print $form->selectyesno($value, (!empty($obj->{$value}) ? $obj->{$value}:''), 1);
|
||||
print $form->selectyesno($value, (!empty($obj->{$value}) ? $obj->{$value} : ''), 1);
|
||||
}
|
||||
print '</td>';
|
||||
} elseif (in_array($value, array('nbjour', 'decalage', 'taux', 'localtax1', 'localtax2'))) {
|
||||
@@ -2627,15 +2665,15 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
}
|
||||
}
|
||||
if (!$transfound) {
|
||||
print '<textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'. $value .'">'.(!empty($obj->{$value}) ? $obj->{$value}:'').'</textarea>';
|
||||
print '<textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'. $value .'">'.(!empty($obj->{$value}) ? $obj->{$value} : '').'</textarea>';
|
||||
} else {
|
||||
print '<input type="hidden" name="'. $value .'" value="'.$transkey.'">';
|
||||
}
|
||||
print '</td>';
|
||||
} elseif ($value == 'price' || preg_match('/^amount/i', $value)) {
|
||||
print '<td><input type="text" class="flat minwidth75" value="'.price((!empty($obj->{$value}) ? $obj->{$value}:'')).'" name="'. $value .'"></td>';
|
||||
print '<td><input type="text" class="flat minwidth75" value="'.price((!empty($obj->{$value}) ? $obj->{$value} : '')).'" name="'. $value .'"></td>';
|
||||
} elseif ($value == 'code' && isset($obj->{$value})) {
|
||||
print '<td><input type="text" class="flat minwidth75 maxwidth100" value="'.(!empty($obj->{$value}) ? $obj->{$value}:'').'" name="'. $value .'"></td>';
|
||||
print '<td><input type="text" class="flat minwidth75 maxwidth100" value="'.(!empty($obj->{$value}) ? $obj->{$value} : '').'" name="'. $value .'"></td>';
|
||||
} elseif ($value == 'unit') {
|
||||
print '<td>';
|
||||
$units = array(
|
||||
@@ -2644,12 +2682,12 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
'point' => $langs->trans('SizeUnitpoint'),
|
||||
'inch' => $langs->trans('SizeUnitinch')
|
||||
);
|
||||
print $form->selectarray('unit', $units, (!empty($obj->{$value}) ? $obj->{$value}:''), 0, 0, 0);
|
||||
print $form->selectarray('unit', $units, (!empty($obj->{$value}) ? $obj->{$value} : ''), 0, 0, 0);
|
||||
print '</td>';
|
||||
} elseif ($value == 'localtax1_type' || $value == 'localtax2_type') {
|
||||
// Le type de taxe locale
|
||||
print '<td class="center">';
|
||||
print $form->selectarray($value, $localtax_typeList, (!empty($obj->{$value}) ? $obj->{$value}:''));
|
||||
print $form->selectarray($value, $localtax_typeList, (!empty($obj->{$value}) ? $obj->{$value} : ''));
|
||||
print '</td>';
|
||||
} elseif ($value == 'accountancy_code' || $value == 'accountancy_code_sell' || $value == 'accountancy_code_buy') {
|
||||
print '<td>';
|
||||
@@ -2683,8 +2721,9 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
print $form->selectTypeDuration('', (empty($obj->type_duration) ? '' : $obj->type_duration), array('i','h'));
|
||||
print '</td>';
|
||||
} else {
|
||||
$fieldValue = isset($obj->{$value}) ? $obj->{$value}: '';
|
||||
$classtd = ''; $class = '';
|
||||
$fieldValue = isset($obj->{$value}) ? $obj->{$value} : '';
|
||||
$classtd = '';
|
||||
$class = '';
|
||||
|
||||
if ($value == 'sortorder') {
|
||||
$fieldlist[$field] = 'position';
|
||||
@@ -2694,10 +2733,12 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
$class = 'maxwidth100';
|
||||
}
|
||||
if (in_array($fieldlist[$field], array('deposit_percent'))) {
|
||||
$classtd = 'right'; $class = 'maxwidth50 right';
|
||||
$classtd = 'right';
|
||||
$class = 'maxwidth50 right';
|
||||
}
|
||||
if (in_array($fieldlist[$field], array('pos', 'position'))) {
|
||||
$classtd = 'right'; $class = 'maxwidth50 right';
|
||||
$classtd = 'right';
|
||||
$class = 'maxwidth50 right';
|
||||
}
|
||||
if (in_array($fieldlist[$field], array('dayrule', 'day', 'month', 'year', 'use_default', 'affect', 'delay', 'public', 'sortorder', 'sens', 'category_type', 'fk_parent'))) {
|
||||
$class = 'maxwidth50 center';
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
*/
|
||||
class PrestaShopWebservice
|
||||
{
|
||||
|
||||
/** @var string Shop URL */
|
||||
protected $url;
|
||||
|
||||
@@ -424,5 +423,4 @@ class PrestaShopWebservice
|
||||
*/
|
||||
class PrestaShopWebserviceException extends Exception
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user