@@ -55,17 +55,17 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $sapi_type = php_sapi_name(); |
| 57 | 57 | $script_file = basename(__FILE__); |
| 58 | -$path = __DIR__ . '/'; |
|
| 58 | +$path = __DIR__.'/'; |
|
| 59 | 59 | |
| 60 | 60 | // Error if Web mode |
| 61 | 61 | if (substr($sapi_type, 0, 3) == 'cgi') { |
| 62 | - echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n"; |
|
| 62 | + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; |
|
| 63 | 63 | exit(-1); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | -require_once $path . "../../htdocs/master.inc.php"; |
|
| 67 | -require_once DOL_DOCUMENT_ROOT . "/cron/class/cronjob.class.php"; |
|
| 68 | -require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; |
|
| 66 | +require_once $path."../../htdocs/master.inc.php"; |
|
| 67 | +require_once DOL_DOCUMENT_ROOT."/cron/class/cronjob.class.php"; |
|
| 68 | +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
|
| 69 | 69 | |
| 70 | 70 | // Check parameters |
| 71 | 71 | if (!isset($argv[1]) || !$argv[1]) { |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $now = dol_now(); |
| 97 | 97 | |
| 98 | 98 | @set_time_limit(0); |
| 99 | -print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " - userlogin=" . $userlogin . " - " . dol_print_date($now, 'dayhourrfc') . " - " . gethostname() . " *****\n"; |
|
| 99 | +print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." - userlogin=".$userlogin." - ".dol_print_date($now, 'dayhourrfc')." - ".gethostname()." *****\n"; |
|
| 100 | 100 | |
| 101 | 101 | // Check module cron is activated |
| 102 | 102 | if (!isModEnabled('cron')) { |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | // If param userlogin is reserved word 'firstadmin' |
| 119 | 119 | if ($userlogin == 'firstadmin') { |
| 120 | - $sql = 'SELECT login, entity from ' . MAIN_DB_PREFIX . 'user WHERE admin = 1 and statut = 1 ORDER BY entity LIMIT 1'; |
|
| 120 | + $sql = 'SELECT login, entity from '.MAIN_DB_PREFIX.'user WHERE admin = 1 and statut = 1 ORDER BY entity LIMIT 1'; |
|
| 121 | 121 | $resql = $db->query($sql); |
| 122 | 122 | if ($resql) { |
| 123 | 123 | $obj = $db->fetch_object($resql); |
| 124 | 124 | if ($obj) { |
| 125 | 125 | $userlogin = $obj->login; |
| 126 | - echo "First admin user found is login '" . $userlogin . "', entity " . $obj->entity . "\n"; |
|
| 126 | + echo "First admin user found is login '".$userlogin."', entity ".$obj->entity."\n"; |
|
| 127 | 127 | } |
| 128 | 128 | } else { |
| 129 | 129 | dol_print_error($db); |
@@ -134,13 +134,13 @@ discard block |
||
| 134 | 134 | $user = new User($db); |
| 135 | 135 | $result = $user->fetch('', $userlogin, '', 1); |
| 136 | 136 | if ($result < 0) { |
| 137 | - echo "User Error: " . $user->error; |
|
| 138 | - dol_syslog("cron_run_jobs.php:: User Error:" . $user->error, LOG_ERR); |
|
| 137 | + echo "User Error: ".$user->error; |
|
| 138 | + dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR); |
|
| 139 | 139 | exit(-1); |
| 140 | 140 | } else { |
| 141 | 141 | if (empty($user->id)) { |
| 142 | - echo "User login: " . $userlogin . " does not exists\n"; |
|
| 143 | - dol_syslog("User login:" . $userlogin . " does not exists", LOG_ERR); |
|
| 142 | + echo "User login: ".$userlogin." does not exists\n"; |
|
| 143 | + dol_syslog("User login:".$userlogin." does not exists", LOG_ERR); |
|
| 144 | 144 | exit(-1); |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -182,8 +182,8 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | $result = $object->fetchAll('ASC,ASC,ASC', 't.priority,t.entity,t.rowid', 0, 0, 1, $filter, 0); |
| 184 | 184 | if ($result < 0) { |
| 185 | - echo "Error: " . $object->error; |
|
| 186 | - dol_syslog("cron_run_jobs.php fetch Error " . $object->error, LOG_ERR); |
|
| 185 | + echo "Error: ".$object->error; |
|
| 186 | + dol_syslog("cron_run_jobs.php fetch Error ".$object->error, LOG_ERR); |
|
| 187 | 187 | exit(-1); |
| 188 | 188 | } |
| 189 | 189 | |
@@ -198,12 +198,12 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | // Loop over job |
| 200 | 200 | foreach ($object->lines as $line) { |
| 201 | - dol_syslog("cron_run_jobs.php cronjobid: " . $line->id . " priority=" . $line->priority . " entity=" . $line->entity . " label=" . $line->label, LOG_DEBUG); |
|
| 202 | - echo "cron_run_jobs.php cronjobid: " . $line->id . " priority=" . $line->priority . " entity=" . $line->entity . " label=" . $line->label; |
|
| 201 | + dol_syslog("cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label, LOG_DEBUG); |
|
| 202 | + echo "cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label; |
|
| 203 | 203 | |
| 204 | 204 | // Force reload of setup for the current entity |
| 205 | 205 | if ((empty($line->entity) ? 1 : $line->entity) != $conf->entity) { |
| 206 | - dol_syslog("cron_run_jobs.php: we work on another entity conf than " . $conf->entity . " so we reload mysoc, langs, user and conf", LOG_DEBUG); |
|
| 206 | + dol_syslog("cron_run_jobs.php: we work on another entity conf than ".$conf->entity." so we reload mysoc, langs, user and conf", LOG_DEBUG); |
|
| 207 | 207 | echo " -> we change entity so we reload mysoc, langs, user and conf"; |
| 208 | 208 | |
| 209 | 209 | $conf->entity = (empty($line->entity) ? 1 : $line->entity); |
@@ -214,13 +214,13 @@ discard block |
||
| 214 | 214 | if ($conf->entity != $user->entity) { |
| 215 | 215 | $result = $user->fetch('', $userlogin, '', 1); |
| 216 | 216 | if ($result < 0) { |
| 217 | - echo "\nUser Error: " . $user->error . "\n"; |
|
| 218 | - dol_syslog("cron_run_jobs.php: User Error:" . $user->error, LOG_ERR); |
|
| 217 | + echo "\nUser Error: ".$user->error."\n"; |
|
| 218 | + dol_syslog("cron_run_jobs.php: User Error:".$user->error, LOG_ERR); |
|
| 219 | 219 | exit(-1); |
| 220 | 220 | } else { |
| 221 | 221 | if ($result == 0) { |
| 222 | - echo "\nUser login: " . $userlogin . " does not exist for entity " . $conf->entity . "\n"; |
|
| 223 | - dol_syslog("cron_run_jobs.php: User login: " . $userlogin . " does not exist", LOG_ERR); |
|
| 222 | + echo "\nUser login: ".$userlogin." does not exist for entity ".$conf->entity."\n"; |
|
| 223 | + dol_syslog("cron_run_jobs.php: User login: ".$userlogin." does not exist", LOG_ERR); |
|
| 224 | 224 | exit(-1); |
| 225 | 225 | } |
| 226 | 226 | } |
@@ -247,23 +247,23 @@ discard block |
||
| 247 | 247 | if ($forcequalified || (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now))) { |
| 248 | 248 | echo " - qualified"; |
| 249 | 249 | |
| 250 | - dol_syslog("cron_run_jobs.php line->datenextrun:" . dol_print_date($line->datenextrun, 'dayhourrfc') . " line->datestart:" . dol_print_date($line->datestart, 'dayhourrfc') . " line->dateend:" . dol_print_date($line->dateend, 'dayhourrfc') . " now:" . dol_print_date($now, 'dayhourrfc')); |
|
| 250 | + dol_syslog("cron_run_jobs.php line->datenextrun:".dol_print_date($line->datenextrun, 'dayhourrfc')." line->datestart:".dol_print_date($line->datestart, 'dayhourrfc')." line->dateend:".dol_print_date($line->dateend, 'dayhourrfc')." now:".dol_print_date($now, 'dayhourrfc')); |
|
| 251 | 251 | |
| 252 | 252 | $cronjob = new Cronjob($db); |
| 253 | 253 | $result = $cronjob->fetch($line->id); |
| 254 | 254 | if ($result < 0) { |
| 255 | - echo " - Error cronjobid: " . $line->id . " cronjob->fetch: " . $cronjob->error . "\n"; |
|
| 256 | - echo "Failed to fetch job " . $line->id . "\n"; |
|
| 257 | - dol_syslog("cron_run_jobs.php::fetch Error " . $cronjob->error, LOG_ERR); |
|
| 255 | + echo " - Error cronjobid: ".$line->id." cronjob->fetch: ".$cronjob->error."\n"; |
|
| 256 | + echo "Failed to fetch job ".$line->id."\n"; |
|
| 257 | + dol_syslog("cron_run_jobs.php::fetch Error ".$cronjob->error, LOG_ERR); |
|
| 258 | 258 | exit(-1); |
| 259 | 259 | } |
| 260 | 260 | // Execute job |
| 261 | 261 | $result = $cronjob->run_jobs($userlogin); |
| 262 | 262 | if ($result < 0) { |
| 263 | - echo " - Error cronjobid: " . $line->id . " cronjob->run_job: " . $cronjob->error . "\n"; |
|
| 263 | + echo " - Error cronjobid: ".$line->id." cronjob->run_job: ".$cronjob->error."\n"; |
|
| 264 | 264 | echo "At least one job failed. Go on menu Home-Setup-Admin tools to see result for each job.\n"; |
| 265 | 265 | echo "You can also enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n"; |
| 266 | - dol_syslog("cron_run_jobs.php::run_jobs Error " . $cronjob->error, LOG_ERR); |
|
| 266 | + dol_syslog("cron_run_jobs.php::run_jobs Error ".$cronjob->error, LOG_ERR); |
|
| 267 | 267 | $nbofjobslaunchedko++; |
| 268 | 268 | $resultstring = 'KO'; |
| 269 | 269 | } else { |
@@ -271,14 +271,14 @@ discard block |
||
| 271 | 271 | $resultstring = 'OK'; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - echo " - run_jobs " . $resultstring . " result = " . $result; |
|
| 274 | + echo " - run_jobs ".$resultstring." result = ".$result; |
|
| 275 | 275 | |
| 276 | 276 | // We re-program the next execution and stores the last execution time for this job |
| 277 | 277 | $result = $cronjob->reprogram_jobs($userlogin, $now); |
| 278 | 278 | if ($result < 0) { |
| 279 | - echo " - Error cronjobid: " . $line->id . " cronjob->reprogram_job: " . $cronjob->error . "\n"; |
|
| 279 | + echo " - Error cronjobid: ".$line->id." cronjob->reprogram_job: ".$cronjob->error."\n"; |
|
| 280 | 280 | echo "Enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n"; |
| 281 | - dol_syslog("cron_run_jobs.php::reprogram_jobs Error " . $cronjob->error, LOG_ERR); |
|
| 281 | + dol_syslog("cron_run_jobs.php::reprogram_jobs Error ".$cronjob->error, LOG_ERR); |
|
| 282 | 282 | exit(-1); |
| 283 | 283 | } |
| 284 | 284 | |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | } else { |
| 287 | 287 | echo " - not qualified\n"; |
| 288 | 288 | |
| 289 | - dol_syslog("cron_run_jobs.php job not qualified line->datenextrun:" . dol_print_date($line->datenextrun, 'dayhourrfc') . " line->datestart:" . dol_print_date($line->datestart, 'dayhourrfc') . " line->dateend:" . dol_print_date($line->dateend, 'dayhourrfc') . " now:" . dol_print_date($now, 'dayhourrfc')); |
|
| 289 | + dol_syslog("cron_run_jobs.php job not qualified line->datenextrun:".dol_print_date($line->datenextrun, 'dayhourrfc')." line->datestart:".dol_print_date($line->datestart, 'dayhourrfc')." line->dateend:".dol_print_date($line->dateend, 'dayhourrfc')." now:".dol_print_date($now, 'dayhourrfc')); |
|
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | |
@@ -311,14 +311,14 @@ discard block |
||
| 311 | 311 | */ |
| 312 | 312 | function usage($path, $script_file) |
| 313 | 313 | { |
| 314 | - print "Usage: " . $script_file . " securitykey userlogin|'firstadmin' [cronjobid] [--force]\n"; |
|
| 314 | + print "Usage: ".$script_file." securitykey userlogin|'firstadmin' [cronjobid] [--force]\n"; |
|
| 315 | 315 | print "The script return 0 when everything worked successfully.\n"; |
| 316 | 316 | print "\n"; |
| 317 | 317 | print "On Linux system, you can have cron jobs ran automatically by adding an entry into cron.\n"; |
| 318 | 318 | print "For example, to run pending tasks each day at 3:30, you can add this line:\n"; |
| 319 | - print "30 3 * * * " . $path . $script_file . " securitykey userlogin > " . DOL_DATA_ROOT . "/" . $script_file . ".log\n"; |
|
| 319 | + print "30 3 * * * ".$path.$script_file." securitykey userlogin > ".DOL_DATA_ROOT."/".$script_file.".log\n"; |
|
| 320 | 320 | print "For example, to run pending tasks every 5mn, you can add this line:\n"; |
| 321 | - print "*/5 * * * * " . $path . $script_file . " securitykey userlogin > " . DOL_DATA_ROOT . "/" . $script_file . ".log\n"; |
|
| 321 | + print "*/5 * * * * ".$path.$script_file." securitykey userlogin > ".DOL_DATA_ROOT."/".$script_file.".log\n"; |
|
| 322 | 322 | print "\n"; |
| 323 | 323 | print "The option --force allow to bypass the check on date of execution so job will be executed even if date is not yet reached.\n"; |
| 324 | 324 | } |
@@ -33,19 +33,19 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | $sapi_type = php_sapi_name(); |
| 35 | 35 | $script_file = basename(__FILE__); |
| 36 | -$path = __DIR__ . '/'; |
|
| 36 | +$path = __DIR__.'/'; |
|
| 37 | 37 | |
| 38 | 38 | // Test if batch mode |
| 39 | 39 | if (substr($sapi_type, 0, 3) == 'cgi') { |
| 40 | - echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n"; |
|
| 40 | + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; |
|
| 41 | 41 | exit(-1); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | -require_once $path . "../../htdocs/master.inc.php"; |
|
| 45 | -require_once DOL_DOCUMENT_ROOT . "/compta/prelevement/class/bonprelevement.class.php"; |
|
| 46 | -require_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php"; |
|
| 47 | -require_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php"; |
|
| 48 | -require_once DOL_DOCUMENT_ROOT . "/compta/paiement/class/paiement.class.php"; |
|
| 44 | +require_once $path."../../htdocs/master.inc.php"; |
|
| 45 | +require_once DOL_DOCUMENT_ROOT."/compta/prelevement/class/bonprelevement.class.php"; |
|
| 46 | +require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"; |
|
| 47 | +require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"; |
|
| 48 | +require_once DOL_DOCUMENT_ROOT."/compta/paiement/class/paiement.class.php"; |
|
| 49 | 49 | |
| 50 | 50 | // Global variables |
| 51 | 51 | $version = constant('DOL_VERSION'); |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | |
| 61 | 61 | @set_time_limit(0); |
| 62 | -print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n"; |
|
| 63 | -dol_syslog($script_file . " launched with arg " . join(',', $argv)); |
|
| 62 | +print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; |
|
| 63 | +dol_syslog($script_file." launched with arg ".join(',', $argv)); |
|
| 64 | 64 | |
| 65 | 65 | $datetimeprev = dol_now(); |
| 66 | 66 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | if (!isset($argv[1])) { // Check parameters |
| 74 | 74 | print "This script check invoices with a withdrawal request and\n"; |
| 75 | 75 | print "then create payment and build a withdraw file.\n"; |
| 76 | - print "Usage: " . $script_file . " simu|real\n"; |
|
| 76 | + print "Usage: ".$script_file." simu|real\n"; |
|
| 77 | 77 | exit(-1); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | $sapi_type = php_sapi_name(); |
| 35 | 35 | $script_file = basename(__FILE__); |
| 36 | -$path = __DIR__ . '/'; |
|
| 36 | +$path = __DIR__.'/'; |
|
| 37 | 37 | |
| 38 | 38 | // Test if batch mode |
| 39 | 39 | if (substr($sapi_type, 0, 3) == 'cgi') { |
| 40 | - echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n"; |
|
| 40 | + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; |
|
| 41 | 41 | exit(-1); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | define('EVEN_IF_ONLY_LOGIN_ALLOWED', 1); // Set this define to 0 if you want to lock your script when dolibarr setup is "locked to admin user only". |
| 46 | 46 | |
| 47 | 47 | // Include and load Dolibarr environment variables |
| 48 | -require_once $path . "../../htdocs/master.inc.php"; |
|
| 49 | -require_once DOL_DOCUMENT_ROOT . "/product/class/product.class.php"; |
|
| 50 | -require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php"; |
|
| 51 | -require_once DOL_DOCUMENT_ROOT . "/core/lib/images.lib.php"; |
|
| 48 | +require_once $path."../../htdocs/master.inc.php"; |
|
| 49 | +require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; |
|
| 50 | +require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; |
|
| 51 | +require_once DOL_DOCUMENT_ROOT."/core/lib/images.lib.php"; |
|
| 52 | 52 | // After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file). |
| 53 | 53 | // $user is created but empty. |
| 54 | 54 | |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | * Main |
| 68 | 68 | */ |
| 69 | 69 | |
| 70 | -print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " - dir=" . DOL_DATA_ROOT . " *****\n"; |
|
| 71 | -dol_syslog($script_file . " launched with arg " . join(',', $argv)); |
|
| 70 | +print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." - dir=".DOL_DATA_ROOT." *****\n"; |
|
| 71 | +dol_syslog($script_file." launched with arg ".join(',', $argv)); |
|
| 72 | 72 | |
| 73 | 73 | if (empty($argv[1])) { |
| 74 | 74 | print "Usage: $script_file subdirtoscan (test|confirm)\n"; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | exit(-1); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | -print '--- start' . "\n"; |
|
| 79 | +print '--- start'."\n"; |
|
| 80 | 80 | |
| 81 | 81 | $dir = DOL_DATA_ROOT; |
| 82 | 82 | $subdir = $argv[1]; |
@@ -84,47 +84,47 @@ discard block |
||
| 84 | 84 | dol_print_error(null, 'dir not defined'); |
| 85 | 85 | exit(1); |
| 86 | 86 | } |
| 87 | -if (!dol_is_dir($dir . '/' . $subdir)) { |
|
| 88 | - print 'Directory ' . $dir . '/' . $subdir . ' not found.' . "\n"; |
|
| 87 | +if (!dol_is_dir($dir.'/'.$subdir)) { |
|
| 88 | + print 'Directory '.$dir.'/'.$subdir.' not found.'."\n"; |
|
| 89 | 89 | exit(2); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | -print 'Scan directory ' . $dir . '/' . $subdir . "\n"; |
|
| 92 | +print 'Scan directory '.$dir.'/'.$subdir."\n"; |
|
| 93 | 93 | |
| 94 | -$filearray = dol_dir_list($dir . '/' . $subdir, "directories", 0, '', 'temp$'); |
|
| 94 | +$filearray = dol_dir_list($dir.'/'.$subdir, "directories", 0, '', 'temp$'); |
|
| 95 | 95 | |
| 96 | 96 | $nbok = $nbko = 0; |
| 97 | 97 | |
| 98 | 98 | $tmpobject = null; |
| 99 | 99 | if ($subdir == 'propale' || $subdir == 'proposal') { |
| 100 | 100 | if (isModEnabled('propal')) { |
| 101 | - require_once DOL_DOCUMENT_ROOT . "/comm/propal/class/propal.class.php"; |
|
| 101 | + require_once DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php"; |
|
| 102 | 102 | $tmpobject = new Propal($db); |
| 103 | 103 | } else { |
| 104 | - print 'Error, module not enabled' . "\n"; |
|
| 104 | + print 'Error, module not enabled'."\n"; |
|
| 105 | 105 | } |
| 106 | 106 | } elseif ($subdir == 'commande' || $subdir == 'order') { |
| 107 | 107 | if (isModEnabled('commande')) { |
| 108 | - require_once DOL_DOCUMENT_ROOT . "/commande/class/commande.class.php"; |
|
| 108 | + require_once DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"; |
|
| 109 | 109 | $tmpobject = new Commande($db); |
| 110 | 110 | } else { |
| 111 | - print 'Error, module not enabled' . "\n"; |
|
| 111 | + print 'Error, module not enabled'."\n"; |
|
| 112 | 112 | } |
| 113 | 113 | } elseif ($subdir == 'facture' || $subdir == 'invoice') { |
| 114 | 114 | if (isModEnabled('facture')) { |
| 115 | - require_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php"; |
|
| 115 | + require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"; |
|
| 116 | 116 | $tmpobject = new Facture($db); |
| 117 | 117 | } else { |
| 118 | - print 'Error, module not enabled' . "\n"; |
|
| 118 | + print 'Error, module not enabled'."\n"; |
|
| 119 | 119 | } |
| 120 | 120 | } else { |
| 121 | - print 'Dir ' . $subdir . ' not yet supported' . "\n"; |
|
| 121 | + print 'Dir '.$subdir.' not yet supported'."\n"; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | if ($tmpobject) { |
| 125 | 125 | foreach ($filearray as $keyf => $valf) { |
| 126 | 126 | $ref = basename($valf['name']); |
| 127 | - print 'Process document for dir = ' . $subdir . ', ref ' . $ref . "\n"; |
|
| 127 | + print 'Process document for dir = '.$subdir.', ref '.$ref."\n"; |
|
| 128 | 128 | |
| 129 | 129 | $ret1 = $tmpobject->fetch(0, $ref); |
| 130 | 130 | $ret2 = $tmpobject->fetch_thirdparty(); |
@@ -153,10 +153,10 @@ discard block |
||
| 153 | 153 | $nbko++; |
| 154 | 154 | } |
| 155 | 155 | if ($result == 0) { |
| 156 | - print 'File for ref ' . $tmpobject->ref . ' returned 0 during regeneration with template ' . $tmpobject->model_pdf . "\n"; |
|
| 156 | + print 'File for ref '.$tmpobject->ref.' returned 0 during regeneration with template '.$tmpobject->model_pdf."\n"; |
|
| 157 | 157 | $nbok++; |
| 158 | 158 | } else { |
| 159 | - print 'File for ref ' . $tmpobject->ref . ' regenerated with template ' . $tmpobject->model_pdf . "\n"; |
|
| 159 | + print 'File for ref '.$tmpobject->ref.' regenerated with template '.$tmpobject->model_pdf."\n"; |
|
| 160 | 160 | $nbok++; |
| 161 | 161 | } |
| 162 | 162 | } else { |
@@ -165,8 +165,8 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | -print $nbok . " objects processed\n"; |
|
| 169 | -print $nbko . " objects with errors\n"; |
|
| 168 | +print $nbok." objects processed\n"; |
|
| 169 | +print $nbko." objects with errors\n"; |
|
| 170 | 170 | |
| 171 | 171 | $db->close(); // Close $db database opened handler |
| 172 | 172 | |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | $sapi_type = php_sapi_name(); |
| 35 | 35 | $script_file = basename(__FILE__); |
| 36 | -$path = __DIR__ . '/'; |
|
| 36 | +$path = __DIR__.'/'; |
|
| 37 | 37 | |
| 38 | 38 | // Test if batch mode |
| 39 | 39 | if (substr($sapi_type, 0, 3) == 'cgi') { |
| 40 | - echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n"; |
|
| 40 | + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; |
|
| 41 | 41 | exit(-1); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | define('EVEN_IF_ONLY_LOGIN_ALLOWED', 1); // Set this define to 0 if you want to lock your script when dolibarr setup is "locked to admin user only". |
| 46 | 46 | |
| 47 | 47 | // Include and load Dolibarr environment variables |
| 48 | -require_once $path . "../../htdocs/master.inc.php"; |
|
| 49 | -require_once DOL_DOCUMENT_ROOT . "/product/class/product.class.php"; |
|
| 50 | -require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php"; |
|
| 51 | -require_once DOL_DOCUMENT_ROOT . "/core/lib/images.lib.php"; |
|
| 48 | +require_once $path."../../htdocs/master.inc.php"; |
|
| 49 | +require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; |
|
| 50 | +require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; |
|
| 51 | +require_once DOL_DOCUMENT_ROOT."/core/lib/images.lib.php"; |
|
| 52 | 52 | // After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file). |
| 53 | 53 | // $user is created but empty. |
| 54 | 54 | |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | * Main |
| 67 | 67 | */ |
| 68 | 68 | |
| 69 | -print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n"; |
|
| 70 | -dol_syslog($script_file . " launched with arg " . join(',', $argv)); |
|
| 69 | +print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; |
|
| 70 | +dol_syslog($script_file." launched with arg ".join(',', $argv)); |
|
| 71 | 71 | |
| 72 | 72 | if (empty($argv[1])) { |
| 73 | 73 | print "Usage: $script_file subdirtoscan\n"; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | exit(-1); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | -print '--- start' . "\n"; |
|
| 78 | +print '--- start'."\n"; |
|
| 79 | 79 | |
| 80 | 80 | $dir = DOL_DATA_ROOT; |
| 81 | 81 | $subdir = $argv[1]; |
@@ -83,12 +83,12 @@ discard block |
||
| 83 | 83 | dol_print_error(null, 'dir not defined'); |
| 84 | 84 | exit(1); |
| 85 | 85 | } |
| 86 | -if (!dol_is_dir($dir . '/' . $subdir)) { |
|
| 87 | - print 'Directory ' . $dir . '/' . $subdir . ' not found.' . "\n"; |
|
| 86 | +if (!dol_is_dir($dir.'/'.$subdir)) { |
|
| 87 | + print 'Directory '.$dir.'/'.$subdir.' not found.'."\n"; |
|
| 88 | 88 | exit(2); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | -$filearray = dol_dir_list($dir . '/' . $subdir, "directories", 0, '', 'temp$'); |
|
| 91 | +$filearray = dol_dir_list($dir.'/'.$subdir, "directories", 0, '', 'temp$'); |
|
| 92 | 92 | |
| 93 | 93 | global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini; |
| 94 | 94 | |
@@ -96,20 +96,20 @@ discard block |
||
| 96 | 96 | $ref = basename($valf['name']); |
| 97 | 97 | $filearrayimg = dol_dir_list($valf['fullname'], "files", 0, '(\.gif|\.png|\.jpg|\.jpeg|\.bmp|\.webp)$', '(\.meta|_preview.*\.png)$'); |
| 98 | 98 | foreach ($filearrayimg as $keyi => $vali) { |
| 99 | - print 'Process image for ref ' . $ref . ' : ' . $vali['name'] . "\n"; |
|
| 99 | + print 'Process image for ref '.$ref.' : '.$vali['name']."\n"; |
|
| 100 | 100 | |
| 101 | 101 | // Create small thumbs for image |
| 102 | 102 | // Used on logon for example |
| 103 | 103 | $imgThumbSmall = vignette($vali['fullname'], $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs"); |
| 104 | 104 | if (preg_match('/Error/', $imgThumbSmall)) { |
| 105 | - print $imgThumbSmall . "\n"; |
|
| 105 | + print $imgThumbSmall."\n"; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // Create mini thumbs for image (Ratio is near 16/9) |
| 109 | 109 | // Used on menu or for setup page for example |
| 110 | 110 | $imgThumbMini = vignette($vali['fullname'], $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs"); |
| 111 | 111 | if (preg_match('/Error/', $imgThumbMini)) { |
| 112 | - print $imgThumbMini . "\n"; |
|
| 112 | + print $imgThumbMini."\n"; |
|
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | } |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | $sapi_type = php_sapi_name(); |
| 36 | 36 | $script_file = basename(__FILE__); |
| 37 | -$path = __DIR__ . '/'; |
|
| 37 | +$path = __DIR__.'/'; |
|
| 38 | 38 | |
| 39 | 39 | // Test if batch mode |
| 40 | 40 | if (substr($sapi_type, 0, 3) == 'cgi') { |
| 41 | - echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n"; |
|
| 41 | + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; |
|
| 42 | 42 | exit(-1); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | define('EVEN_IF_ONLY_LOGIN_ALLOWED', 1); // Set this define to 0 if you want to lock your script when dolibarr setup is "locked to admin user only". |
| 47 | 47 | |
| 48 | 48 | // Include and load Dolibarr environment variables |
| 49 | -require_once $path . "../../htdocs/master.inc.php"; |
|
| 50 | -require_once DOL_DOCUMENT_ROOT . "/product/class/product.class.php"; |
|
| 51 | -require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php"; |
|
| 49 | +require_once $path."../../htdocs/master.inc.php"; |
|
| 50 | +require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; |
|
| 51 | +require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; |
|
| 52 | 52 | // After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file). |
| 53 | 53 | // $user is created but empty. |
| 54 | 54 | |
@@ -67,30 +67,30 @@ discard block |
||
| 67 | 67 | * Main |
| 68 | 68 | */ |
| 69 | 69 | |
| 70 | -print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n"; |
|
| 71 | -dol_syslog($script_file . " launched with arg " . join(',', $argv)); |
|
| 70 | +print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; |
|
| 71 | +dol_syslog($script_file." launched with arg ".join(',', $argv)); |
|
| 72 | 72 | |
| 73 | 73 | if (!isset($argv[1]) || $argv[1] != 'product') { |
| 74 | 74 | print "Usage: $script_file product\n"; |
| 75 | 75 | exit(-1); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | -print '--- start' . "\n"; |
|
| 78 | +print '--- start'."\n"; |
|
| 79 | 79 | |
| 80 | 80 | // Case to migrate products path |
| 81 | 81 | if ($argv[1] == 'product') { |
| 82 | 82 | $product = new Product($db); |
| 83 | 83 | |
| 84 | - $sql = "SELECT rowid as pid from " . MAIN_DB_PREFIX . "product"; // Get list of all products |
|
| 84 | + $sql = "SELECT rowid as pid from ".MAIN_DB_PREFIX."product"; // Get list of all products |
|
| 85 | 85 | $resql = $db->query($sql); |
| 86 | 86 | if ($resql) { |
| 87 | 87 | while ($obj = $db->fetch_object($resql)) { |
| 88 | 88 | $product->fetch($obj->pid); |
| 89 | - print " migrating product id=" . $product->id . " ref=" . $product->ref . "\n"; |
|
| 89 | + print " migrating product id=".$product->id." ref=".$product->ref."\n"; |
|
| 90 | 90 | migrate_product_photospath($product); |
| 91 | 91 | } |
| 92 | 92 | } else { |
| 93 | - print "\n sql error " . $sql; |
|
| 93 | + print "\n sql error ".$sql; |
|
| 94 | 94 | exit(); |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | $dir = $conf->product->multidir_output[$product->entity]; |
| 113 | 113 | $conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO = 1; |
| 114 | - $origin = $dir . '/' . get_exdir($product->id, 2, 0, 0, $product, 'product') . $product->id . "/photos"; |
|
| 115 | - $destin = $dir . '/' . dol_sanitizeFileName($product->ref); |
|
| 114 | + $origin = $dir.'/'.get_exdir($product->id, 2, 0, 0, $product, 'product').$product->id."/photos"; |
|
| 115 | + $destin = $dir.'/'.dol_sanitizeFileName($product->ref); |
|
| 116 | 116 | |
| 117 | 117 | $error = 0; |
| 118 | 118 | |
@@ -124,18 +124,18 @@ discard block |
||
| 124 | 124 | $handle = opendir($origin_osencoded); |
| 125 | 125 | if (is_resource($handle)) { |
| 126 | 126 | while (($file = readdir($handle)) !== false) { |
| 127 | - if ($file != '.' && $file != '..' && is_dir($origin_osencoded . '/' . $file)) { |
|
| 128 | - $thumbs = opendir($origin_osencoded . '/' . $file); |
|
| 127 | + if ($file != '.' && $file != '..' && is_dir($origin_osencoded.'/'.$file)) { |
|
| 128 | + $thumbs = opendir($origin_osencoded.'/'.$file); |
|
| 129 | 129 | if (is_resource($thumbs)) { |
| 130 | - dol_mkdir($destin . '/' . $file); |
|
| 130 | + dol_mkdir($destin.'/'.$file); |
|
| 131 | 131 | while (($thumb = readdir($thumbs)) !== false) { |
| 132 | - dol_move($origin . '/' . $file . '/' . $thumb, $destin . '/' . $file . '/' . $thumb); |
|
| 132 | + dol_move($origin.'/'.$file.'/'.$thumb, $destin.'/'.$file.'/'.$thumb); |
|
| 133 | 133 | } |
| 134 | 134 | // dol_delete_dir($origin.'/'.$file); |
| 135 | 135 | } |
| 136 | 136 | } else { |
| 137 | - if (dol_is_file($origin . '/' . $file)) { |
|
| 138 | - dol_move($origin . '/' . $file, $destin . '/' . $file); |
|
| 137 | + if (dol_is_file($origin.'/'.$file)) { |
|
| 138 | + dol_move($origin.'/'.$file, $destin.'/'.$file); |
|
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | } |
@@ -35,16 +35,16 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | $sapi_type = php_sapi_name(); |
| 37 | 37 | $script_file = basename(__FILE__); |
| 38 | -$path = __DIR__ . '/'; |
|
| 38 | +$path = __DIR__.'/'; |
|
| 39 | 39 | |
| 40 | 40 | // Test if batch mode |
| 41 | 41 | if (substr($sapi_type, 0, 3) == 'cgi') { |
| 42 | - echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n"; |
|
| 42 | + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; |
|
| 43 | 43 | exit(-1); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | if (!isset($argv[3]) || !$argv[3]) { |
| 47 | - print "Usage: " . $script_file . " inputfile-with-invalid-emails type [test|confirm]\n"; |
|
| 47 | + print "Usage: ".$script_file." inputfile-with-invalid-emails type [test|confirm]\n"; |
|
| 48 | 48 | print "- inputfile-with-invalid-emails is a file with list of invalid email\n"; |
| 49 | 49 | print "- type can be 'all' or 'thirdparties', 'contacts', 'members', 'users'\n"; |
| 50 | 50 | exit(-1); |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | $type = $argv[2]; |
| 54 | 54 | $mode = $argv[3]; |
| 55 | 55 | |
| 56 | -require_once $path . "../../htdocs/master.inc.php"; |
|
| 57 | -require_once DOL_DOCUMENT_ROOT . "/core/class/CMailFile.class.php"; |
|
| 58 | -require_once DOL_DOCUMENT_ROOT . "/comm/mailing/class/mailing.class.php"; |
|
| 56 | +require_once $path."../../htdocs/master.inc.php"; |
|
| 57 | +require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"; |
|
| 58 | +require_once DOL_DOCUMENT_ROOT."/comm/mailing/class/mailing.class.php"; |
|
| 59 | 59 | |
| 60 | 60 | // Global variables |
| 61 | 61 | $version = DOL_VERSION; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $user = new User($db); |
| 77 | 77 | |
| 78 | 78 | @set_time_limit(0); |
| 79 | -print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n"; |
|
| 79 | +print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; |
|
| 80 | 80 | |
| 81 | 81 | if (!in_array($type, array('all', 'thirdparties', 'contacts', 'users', 'members'))) { |
| 82 | 82 | print "Bad value for parameter type.\n"; |
@@ -114,21 +114,21 @@ discard block |
||
| 114 | 114 | // Generate the string tp allow a mass update (with a limit of MAXEMAILS per request). |
| 115 | 115 | $emailsin = ''; |
| 116 | 116 | foreach ($groupofemails as $email) { |
| 117 | - $emailsin .= ($emailsin ? ", " : "") . "'" . $db->escape($email) . "'"; |
|
| 117 | + $emailsin .= ($emailsin ? ", " : "")."'".$db->escape($email)."'"; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // For each groupofemail, we update tables to set email field to empty |
| 121 | 121 | $nbingroup = count($groupofemails); |
| 122 | 122 | |
| 123 | - print "Process group of " . $nbingroup . " emails (" . $counter . " - " . ($counter + $nbingroup - 1) . "), type = " . $type . "\n"; |
|
| 123 | + print "Process group of ".$nbingroup." emails (".$counter." - ".($counter + $nbingroup - 1)."), type = ".$type."\n"; |
|
| 124 | 124 | |
| 125 | 125 | $numerased = 0; |
| 126 | 126 | |
| 127 | - $sql_base = "UPDATE " . MAIN_DB_PREFIX; |
|
| 127 | + $sql_base = "UPDATE ".MAIN_DB_PREFIX; |
|
| 128 | 128 | |
| 129 | 129 | if ($type == 'all' || $type == 'users') { |
| 130 | 130 | // Loop on each record and update the email to null if email into $groupofemails |
| 131 | - $sql = $sql_base . "user as u SET u.email = NULL WHERE u.email IN (" . $db->sanitize($emailsin, 1) . ");"; |
|
| 131 | + $sql = $sql_base."user as u SET u.email = NULL WHERE u.email IN (".$db->sanitize($emailsin, 1).");"; |
|
| 132 | 132 | print "Try to update users, "; |
| 133 | 133 | $resql = $db->query($sql); |
| 134 | 134 | if (!$resql) { |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | if ($type == 'all' || $type == 'thirdparties') { |
| 141 | 141 | // Loop on each record and update the email to null if email into $groupofemails |
| 142 | - $sql = $sql_base . "societe as s SET s.email = NULL WHERE s.email IN (" . $db->sanitize($emailsin, 1) . ");"; |
|
| 142 | + $sql = $sql_base."societe as s SET s.email = NULL WHERE s.email IN (".$db->sanitize($emailsin, 1).");"; |
|
| 143 | 143 | print "Try to update thirdparties, "; |
| 144 | 144 | $resql = $db->query($sql); |
| 145 | 145 | if (!$resql) { |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | if ($type == 'all' || $type == 'contacts') { |
| 152 | 152 | // Loop on each record and update the email to null if email into $groupofemails |
| 153 | 153 | |
| 154 | - $sql = $sql_base . "socpeople as s SET s.email = NULL WHERE s.email IN (" . $db->sanitize($emailsin, 1) . ");"; |
|
| 154 | + $sql = $sql_base."socpeople as s SET s.email = NULL WHERE s.email IN (".$db->sanitize($emailsin, 1).");"; |
|
| 155 | 155 | print "Try to update contacts, "; |
| 156 | 156 | $resql = $db->query($sql); |
| 157 | 157 | if (!$resql) { |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | if ($type == 'all' || $type == 'members') { |
| 164 | 164 | // Loop on each record and update the email to null if email into $groupofemails |
| 165 | 165 | |
| 166 | - $sql = $sql_base . "adherent as a SET a.email = NULL WHERE a.email IN (" . $db->sanitize($emailsin, 1) . ");"; |
|
| 166 | + $sql = $sql_base."adherent as a SET a.email = NULL WHERE a.email IN (".$db->sanitize($emailsin, 1).");"; |
|
| 167 | 167 | print "Try to update members, "; |
| 168 | 168 | $resql = $db->query($sql); |
| 169 | 169 | if (!$resql) { |
@@ -174,15 +174,15 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | $numerasedtotal += $numerased; |
| 176 | 176 | |
| 177 | - print $numerased . " emails cleared.\n"; |
|
| 177 | + print $numerased." emails cleared.\n"; |
|
| 178 | 178 | $counter = $counter + $nbingroup; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | if (!$error && $mode == 'confirm') { |
| 182 | - print "Commit - " . $numerasedtotal . " operations validated.\n"; |
|
| 182 | + print "Commit - ".$numerasedtotal." operations validated.\n"; |
|
| 183 | 183 | $db->commit(); |
| 184 | 184 | } else { |
| 185 | - print "Rollback - " . $numerasedtotal . " Operations canceled.\n"; |
|
| 185 | + print "Rollback - ".$numerasedtotal." Operations canceled.\n"; |
|
| 186 | 186 | $db->rollback(); |
| 187 | 187 | } |
| 188 | 188 | |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $sapi_type = php_sapi_name(); |
| 34 | 34 | $script_file = basename(__FILE__); |
| 35 | -$path = __DIR__ . '/'; |
|
| 35 | +$path = __DIR__.'/'; |
|
| 36 | 36 | |
| 37 | 37 | // Test if batch mode |
| 38 | 38 | if (substr($sapi_type, 0, 3) == 'cgi') { |
| 39 | - echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n"; |
|
| 39 | + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; |
|
| 40 | 40 | exit(-1); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -55,17 +55,17 @@ discard block |
||
| 55 | 55 | $forcelang = (empty($argv[6]) ? '' : $argv[6]); |
| 56 | 56 | |
| 57 | 57 | if (empty($argv[3]) || !in_array($argv[1], array('test', 'confirm')) || empty($websiteref)) { |
| 58 | - print '***** ' . $script_file . ' *****' . "\n"; |
|
| 58 | + print '***** '.$script_file.' *****'."\n"; |
|
| 59 | 59 | print "Usage: $script_file (test|confirm) website login:pass@serverjoomla/tableprefix/databasejoomla [nbmaxrecord]\n"; |
| 60 | 60 | print "\n"; |
| 61 | 61 | print "Load joomla news and create them into Dolibarr database (if they don't already exist).\n"; |
| 62 | 62 | exit(-1); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | -require $path . "../../htdocs/master.inc.php"; |
|
| 66 | -include_once DOL_DOCUMENT_ROOT . '/website/class/website.class.php'; |
|
| 67 | -include_once DOL_DOCUMENT_ROOT . '/website/class/websitepage.class.php'; |
|
| 68 | -include_once DOL_DOCUMENT_ROOT . '/core/lib/website2.lib.php'; |
|
| 65 | +require $path."../../htdocs/master.inc.php"; |
|
| 66 | +include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; |
|
| 67 | +include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; |
|
| 68 | +include_once DOL_DOCUMENT_ROOT.'/core/lib/website2.lib.php'; |
|
| 69 | 69 | |
| 70 | 70 | $hookmanager->initHooks(array('cli')); |
| 71 | 71 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $website = new Website($db); |
| 94 | 94 | $result = $website->fetch(0, $websiteref); |
| 95 | 95 | if ($result <= 0) { |
| 96 | - print 'Error, web site ' . $websiteref . ' not found' . "\n"; |
|
| 96 | + print 'Error, web site '.$websiteref.' not found'."\n"; |
|
| 97 | 97 | exit(-1); |
| 98 | 98 | } |
| 99 | 99 | $websiteid = $website->id; |
@@ -101,14 +101,14 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | $dbjoomla = getDoliDBInstance('mysqli', $joomlahost, $joomlalogin, $joomlapass, $joomladatabase, $joomlaport); |
| 103 | 103 | if ($dbjoomla->error) { |
| 104 | - dol_print_error($dbjoomla, "host=" . $joomlahost . ", port=" . $joomlaport . ", user=" . $joomlalogin . ", databasename=" . $joomladatabase . ", " . $dbjoomla->error); |
|
| 104 | + dol_print_error($dbjoomla, "host=".$joomlahost.", port=".$joomlaport.", user=".$joomlalogin.", databasename=".$joomladatabase.", ".$dbjoomla->error); |
|
| 105 | 105 | exit(-1); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | -$sql = 'SELECT c.id, c.title, c.alias, c.created, c.introtext, `fulltext`, c.metadesc, c.metakey, c.language, c.created, c.publish_up, u.username FROM ' . $joomlaprefix . '_content as c'; |
|
| 109 | -$sql .= ' LEFT JOIN ' . $joomlaprefix . '_users as u ON u.id = c.created_by'; |
|
| 108 | +$sql = 'SELECT c.id, c.title, c.alias, c.created, c.introtext, `fulltext`, c.metadesc, c.metakey, c.language, c.created, c.publish_up, u.username FROM '.$joomlaprefix.'_content as c'; |
|
| 109 | +$sql .= ' LEFT JOIN '.$joomlaprefix.'_users as u ON u.id = c.created_by'; |
|
| 110 | 110 | $sql .= ' WHERE featured = 1'; |
| 111 | -$sql .= ' AND c.id NOT IN (' . $excludeid . ')'; |
|
| 111 | +$sql .= ' AND c.id NOT IN ('.$excludeid.')'; |
|
| 112 | 112 | $sql .= ' ORDER BY publish_up ASC'; |
| 113 | 113 | $resql = $dbjoomla->query($sql); |
| 114 | 114 | |
@@ -117,12 +117,12 @@ discard block |
||
| 117 | 117 | exit; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | -$blogpostheader = file_get_contents($path . 'blogpost-header.txt'); |
|
| 120 | +$blogpostheader = file_get_contents($path.'blogpost-header.txt'); |
|
| 121 | 121 | if ($blogpostheader === false) { |
| 122 | 122 | print "Error: Failed to load file content of 'blogpost-header.txt'\n"; |
| 123 | 123 | exit(-1); |
| 124 | 124 | } |
| 125 | -$blogpostfooter = file_get_contents($path . 'blogpost-footer.txt'); |
|
| 125 | +$blogpostfooter = file_get_contents($path.'blogpost-footer.txt'); |
|
| 126 | 126 | if ($blogpostfooter === false) { |
| 127 | 127 | print "Error: Failed to load file content of 'blogpost-footer.txt'\n"; |
| 128 | 128 | exit(-1); |
@@ -149,19 +149,19 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | $htmltext = ""; |
| 151 | 151 | if ($blogpostheader) { |
| 152 | - $htmltext .= $blogpostheader . "\n"; |
|
| 152 | + $htmltext .= $blogpostheader."\n"; |
|
| 153 | 153 | } |
| 154 | - $htmltext .= '<section id="mysectionnewsintro" contenteditable="true">' . "\n"; |
|
| 154 | + $htmltext .= '<section id="mysectionnewsintro" contenteditable="true">'."\n"; |
|
| 155 | 155 | $htmltext .= $obj->introtext; |
| 156 | - $htmltext .= '</section>' . "\n"; |
|
| 156 | + $htmltext .= '</section>'."\n"; |
|
| 157 | 157 | if ($obj->fulltext) { |
| 158 | - $htmltext .= '<section id="mysectionnewscontent" contenteditable="true">' . "\n"; |
|
| 159 | - $htmltext .= '<br>' . "\n" . '<hr>' . "\n" . '<br>' . "\n"; |
|
| 158 | + $htmltext .= '<section id="mysectionnewscontent" contenteditable="true">'."\n"; |
|
| 159 | + $htmltext .= '<br>'."\n".'<hr>'."\n".'<br>'."\n"; |
|
| 160 | 160 | $htmltext .= $obj->fulltext; |
| 161 | 161 | $htmltext .= "</section>"; |
| 162 | 162 | } |
| 163 | 163 | if ($blogpostfooter) { |
| 164 | - $htmltext .= "\n" . $blogpostfooter; |
|
| 164 | + $htmltext .= "\n".$blogpostfooter; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | $language = ($forcelang ? $forcelang : ($obj->language && $obj->language != '*' ? $obj->language : 'en')); |
@@ -170,39 +170,39 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | $date_creation = $dbjoomla->jdate($obj->publish_up); |
| 172 | 172 | |
| 173 | - print '#' . $i . ' id=' . $id . ' ' . $title . ' lang=' . $language . ' keywords=' . $keywords . ' importid=' . $importid . "\n"; |
|
| 173 | + print '#'.$i.' id='.$id.' '.$title.' lang='.$language.' keywords='.$keywords.' importid='.$importid."\n"; |
|
| 174 | 174 | |
| 175 | - $sqlinsert = 'INSERT INTO ' . MAIN_DB_PREFIX . 'website_page(fk_website, pageurl, aliasalt, title, description, keywords, content, status, type_container, lang, import_key, image, date_creation, author_alias)'; |
|
| 176 | - $sqlinsert .= " VALUES(" . $websiteid . ", '" . $db->escape($alias) . "', '', '" . $db->escape($title) . "', '" . $db->escape($description) . "', '" . $db->escape($keywords) . "', "; |
|
| 177 | - $sqlinsert .= " '" . $db->escape($htmltext) . "', '1', 'blogpost', '" . $db->escape($language) . "', '" . $db->escape($importid) . "', '" . $db->escape($image) . "', '" . $db->idate($date_creation) . "', '" . $db->escape($author_alias) . "')"; |
|
| 178 | - print $sqlinsert . "\n"; |
|
| 175 | + $sqlinsert = 'INSERT INTO '.MAIN_DB_PREFIX.'website_page(fk_website, pageurl, aliasalt, title, description, keywords, content, status, type_container, lang, import_key, image, date_creation, author_alias)'; |
|
| 176 | + $sqlinsert .= " VALUES(".$websiteid.", '".$db->escape($alias)."', '', '".$db->escape($title)."', '".$db->escape($description)."', '".$db->escape($keywords)."', "; |
|
| 177 | + $sqlinsert .= " '".$db->escape($htmltext)."', '1', 'blogpost', '".$db->escape($language)."', '".$db->escape($importid)."', '".$db->escape($image)."', '".$db->idate($date_creation)."', '".$db->escape($author_alias)."')"; |
|
| 178 | + print $sqlinsert."\n"; |
|
| 179 | 179 | |
| 180 | 180 | $result = $db->query($sqlinsert); |
| 181 | 181 | if ($result <= 0) { |
| 182 | - print 'ERROR: ' . $db->lasterrno . ": " . $sqlinsert . "\n"; |
|
| 182 | + print 'ERROR: '.$db->lasterrno.": ".$sqlinsert."\n"; |
|
| 183 | 183 | if ($db->lasterrno != 'DB_ERROR_RECORD_ALREADY_EXISTS') { |
| 184 | 184 | $error++; |
| 185 | 185 | } else { |
| 186 | 186 | $nbalreadyexists++; |
| 187 | 187 | } |
| 188 | 188 | } else { |
| 189 | - $pageid = $db->last_insert_id(MAIN_DB_PREFIX . 'website_page'); |
|
| 189 | + $pageid = $db->last_insert_id(MAIN_DB_PREFIX.'website_page'); |
|
| 190 | 190 | |
| 191 | 191 | if ($pageid > 0) { // We must also regenerate page on disk |
| 192 | 192 | global $dolibarr_main_data_root; |
| 193 | - $pathofwebsite = $dolibarr_main_data_root . '/website/' . $websiteref; |
|
| 194 | - $filetpl = $pathofwebsite . '/page' . $pageid . '.tpl.php'; |
|
| 193 | + $pathofwebsite = $dolibarr_main_data_root.'/website/'.$websiteref; |
|
| 194 | + $filetpl = $pathofwebsite.'/page'.$pageid.'.tpl.php'; |
|
| 195 | 195 | $websitepage = new WebsitePage($db); |
| 196 | 196 | $websitepage->fetch($pageid); |
| 197 | 197 | dolSavePageContent($filetpl, $website, $websitepage); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - print "Insert done - pageid = " . $pageid . "\n"; |
|
| 200 | + print "Insert done - pageid = ".$pageid."\n"; |
|
| 201 | 201 | $nbimported++; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | if ($max && $i >= $max) { |
| 205 | - print 'Nb max of record (' . $max . ') reached. We stop now.' . "\n"; |
|
| 205 | + print 'Nb max of record ('.$max.') reached. We stop now.'."\n"; |
|
| 206 | 206 | break; |
| 207 | 207 | } |
| 208 | 208 | } |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | if ($mode == 'confirm' && !$error) { |
| 212 | 212 | print "Commit\n"; |
| 213 | - print $nbalreadyexists . " page(s) already exists.\n"; |
|
| 214 | - print $nbimported . " page(s) imported with importid=" . $importid . "\n"; |
|
| 213 | + print $nbalreadyexists." page(s) already exists.\n"; |
|
| 214 | + print $nbimported." page(s) imported with importid=".$importid."\n"; |
|
| 215 | 215 | $db->commit(); |
| 216 | 216 | } else { |
| 217 | 217 | print "Rollback (mode=test)\n"; |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $sapi_type = php_sapi_name(); |
| 34 | 34 | $script_file = basename(__FILE__); |
| 35 | -$path = __DIR__ . '/'; |
|
| 35 | +$path = __DIR__.'/'; |
|
| 36 | 36 | |
| 37 | 37 | // Test if batch mode |
| 38 | 38 | if (substr($sapi_type, 0, 3) == 'cgi') { |
| 39 | - echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n"; |
|
| 39 | + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; |
|
| 40 | 40 | exit(-1); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -50,17 +50,17 @@ discard block |
||
| 50 | 50 | $max = (!isset($argv[3]) || (empty($argv[3]) && $argv[3] !== '0')) ? '10' : $argv[3]; |
| 51 | 51 | |
| 52 | 52 | if (empty($argv[2]) || !in_array($argv[1], array('test', 'confirm')) || empty($websiteref)) { |
| 53 | - print '***** ' . $script_file . ' *****' . "\n"; |
|
| 53 | + print '***** '.$script_file.' *****'."\n"; |
|
| 54 | 54 | print "Usage: $script_file (test|confirm) website [nbmaxrecord]\n"; |
| 55 | 55 | print "\n"; |
| 56 | 56 | print "Regenerate all pages of a web site.\n"; |
| 57 | 57 | exit(-1); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | -require $path . "../../htdocs/master.inc.php"; |
|
| 61 | -include_once DOL_DOCUMENT_ROOT . '/website/class/website.class.php'; |
|
| 62 | -include_once DOL_DOCUMENT_ROOT . '/website/class/websitepage.class.php'; |
|
| 63 | -include_once DOL_DOCUMENT_ROOT . '/core/lib/website2.lib.php'; |
|
| 60 | +require $path."../../htdocs/master.inc.php"; |
|
| 61 | +include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; |
|
| 62 | +include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; |
|
| 63 | +include_once DOL_DOCUMENT_ROOT.'/core/lib/website2.lib.php'; |
|
| 64 | 64 | |
| 65 | 65 | $hookmanager->initHooks(array('cli')); |
| 66 | 66 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $website = new Website($db); |
| 80 | 80 | $result = $website->fetch(0, $websiteref); |
| 81 | 81 | if ($result <= 0) { |
| 82 | - print 'Error, web site ' . $websiteref . ' not found' . "\n"; |
|
| 82 | + print 'Error, web site '.$websiteref.' not found'."\n"; |
|
| 83 | 83 | exit(-1); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -90,29 +90,29 @@ discard block |
||
| 90 | 90 | $listofpages = $websitepagestatic->fetchAll($website->id, '', '', $max); |
| 91 | 91 | |
| 92 | 92 | global $dolibarr_main_data_root; |
| 93 | -$pathofwebsite = $dolibarr_main_data_root . '/website/' . $websiteref; |
|
| 93 | +$pathofwebsite = $dolibarr_main_data_root.'/website/'.$websiteref; |
|
| 94 | 94 | |
| 95 | 95 | $nbgenerated = 0; |
| 96 | 96 | foreach ($listofpages as $websitepage) { |
| 97 | - $filealias = $pathofwebsite . '/' . $websitepage->pageurl . '.php'; |
|
| 98 | - $filetpl = $pathofwebsite . '/page' . $websitepage->id . '.tpl.php'; |
|
| 97 | + $filealias = $pathofwebsite.'/'.$websitepage->pageurl.'.php'; |
|
| 98 | + $filetpl = $pathofwebsite.'/page'.$websitepage->id.'.tpl.php'; |
|
| 99 | 99 | if ($mode == 'confirm') { |
| 100 | 100 | dolSavePageAlias($filealias, $website, $websitepage); |
| 101 | 101 | dolSavePageContent($filetpl, $website, $websitepage); |
| 102 | 102 | } |
| 103 | - print "Generation of page done - pageid = " . $websitepage->id . " - " . $websitepage->pageurl . "\n"; |
|
| 103 | + print "Generation of page done - pageid = ".$websitepage->id." - ".$websitepage->pageurl."\n"; |
|
| 104 | 104 | $nbgenerated++; |
| 105 | 105 | |
| 106 | 106 | if ($max && $nbgenerated >= $max) { |
| 107 | - print 'Nb max of record (' . $max . ') reached. We stop now.' . "\n"; |
|
| 107 | + print 'Nb max of record ('.$max.') reached. We stop now.'."\n"; |
|
| 108 | 108 | break; |
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | if ($mode == 'confirm') { |
| 113 | - print $nbgenerated . " page(s) generated into " . $pathofwebsite . "\n"; |
|
| 113 | + print $nbgenerated." page(s) generated into ".$pathofwebsite."\n"; |
|
| 114 | 114 | } else { |
| 115 | - print $nbgenerated . " page(s) found but not generated (test mode)\n"; |
|
| 115 | + print $nbgenerated." page(s) found but not generated (test mode)\n"; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | exit($error); |
@@ -33,21 +33,21 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | $sapi_type = php_sapi_name(); |
| 35 | 35 | $script_file = basename(__FILE__); |
| 36 | -$path = __DIR__ . '/'; |
|
| 36 | +$path = __DIR__.'/'; |
|
| 37 | 37 | |
| 38 | 38 | // Test if batch mode |
| 39 | 39 | if (substr($sapi_type, 0, 3) == 'cgi') { |
| 40 | - echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n"; |
|
| 40 | + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; |
|
| 41 | 41 | exit(-1); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // Include Dolibarr environment |
| 45 | -require_once $path . "../../htdocs/master.inc.php"; |
|
| 45 | +require_once $path."../../htdocs/master.inc.php"; |
|
| 46 | 46 | // After this $db is an opened handler to database. We close it at end of file. |
| 47 | -require_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php"; |
|
| 48 | -require_once DOL_DOCUMENT_ROOT . "/core/modules/facture/modules_facture.php"; |
|
| 49 | -require_once DOL_DOCUMENT_ROOT . "/core/lib/date.lib.php"; |
|
| 50 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice2.lib.php'; |
|
| 47 | +require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"; |
|
| 48 | +require_once DOL_DOCUMENT_ROOT."/core/modules/facture/modules_facture.php"; |
|
| 49 | +require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"; |
|
| 50 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice2.lib.php'; |
|
| 51 | 51 | |
| 52 | 52 | // Load main language strings |
| 53 | 53 | $langs->load("main"); |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | |
| 66 | 66 | @set_time_limit(0); |
| 67 | -print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n"; |
|
| 68 | -dol_syslog($script_file . " launched with arg " . join(',', $argv)); |
|
| 67 | +print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; |
|
| 68 | +dol_syslog($script_file." launched with arg ".join(',', $argv)); |
|
| 69 | 69 | |
| 70 | 70 | // Check parameters |
| 71 | 71 | if (!isset($argv[1])) { |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | exit(-1); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | -$diroutputpdf = $conf->facture->dir_output . '/temp'; |
|
| 81 | +$diroutputpdf = $conf->facture->dir_output.'/temp'; |
|
| 82 | 82 | $newlangid = 'en_EN'; // To force a new lang id |
| 83 | 83 | $filter = array(); |
| 84 | 84 | $regenerate = ''; // Ask regenerate (contains name of model to use) |
@@ -99,99 +99,99 @@ discard block |
||
| 99 | 99 | $found = true; |
| 100 | 100 | $valarray = explode('=', $value); |
| 101 | 101 | $newlangid = $valarray[1]; |
| 102 | - print 'Use language ' . $newlangid . ".\n"; |
|
| 102 | + print 'Use language '.$newlangid.".\n"; |
|
| 103 | 103 | } |
| 104 | 104 | if (preg_match('/^prefix=/i', $value)) { |
| 105 | 105 | $found = true; |
| 106 | 106 | $valarray = explode('=', $value); |
| 107 | 107 | $fileprefix = $valarray[1]; |
| 108 | - print 'Use prefix for filename ' . $fileprefix . ".\n"; |
|
| 108 | + print 'Use prefix for filename '.$fileprefix.".\n"; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | if (preg_match('/^regenerate=(.*)/i', $value, $reg)) { |
| 112 | 112 | if (!in_array($reg[1], array('', '0', 'no'))) { |
| 113 | 113 | $found = true; |
| 114 | 114 | $regenerate = $reg[1]; |
| 115 | - print 'Regeneration of PDF is requested with template ' . $regenerate . "\n"; |
|
| 115 | + print 'Regeneration of PDF is requested with template '.$regenerate."\n"; |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | if ($value == 'filter=all') { |
| 120 | 120 | $found = true; |
| 121 | - $option .= (empty($option) ? '' : '_') . 'all'; |
|
| 121 | + $option .= (empty($option) ? '' : '_').'all'; |
|
| 122 | 122 | $filter[] = 'all'; |
| 123 | 123 | |
| 124 | - print 'Rebuild PDF for all invoices' . "\n"; |
|
| 124 | + print 'Rebuild PDF for all invoices'."\n"; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if ($value == 'filter=date') { |
| 128 | 128 | $found = true; |
| 129 | - $option .= (empty($option) ? '' : '_') . 'date_' . $argv[$key + 1] . '_' . $argv[$key + 2]; |
|
| 129 | + $option .= (empty($option) ? '' : '_').'date_'.$argv[$key + 1].'_'.$argv[$key + 2]; |
|
| 130 | 130 | $filter[] = 'date'; |
| 131 | 131 | |
| 132 | 132 | $dateafterdate = dol_stringtotime($argv[$key + 1]); |
| 133 | 133 | $datebeforedate = dol_stringtotime($argv[$key + 2]); |
| 134 | - print 'Rebuild PDF for invoices validated between ' . dol_print_date($dateafterdate, 'day', 'gmt') . " and " . dol_print_date($datebeforedate, 'day', 'gmt') . ".\n"; |
|
| 134 | + print 'Rebuild PDF for invoices validated between '.dol_print_date($dateafterdate, 'day', 'gmt')." and ".dol_print_date($datebeforedate, 'day', 'gmt').".\n"; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if ($value == 'filter=payments') { |
| 138 | 138 | $found = true; |
| 139 | - $option .= (empty($option) ? '' : '_') . 'payments_' . $argv[$key + 1] . '_' . $argv[$key + 2]; |
|
| 139 | + $option .= (empty($option) ? '' : '_').'payments_'.$argv[$key + 1].'_'.$argv[$key + 2]; |
|
| 140 | 140 | $filter[] = 'payments'; |
| 141 | 141 | |
| 142 | - $paymentdateafter = dol_stringtotime($argv[$key + 1] . '000000'); |
|
| 143 | - $paymentdatebefore = dol_stringtotime($argv[$key + 2] . '235959'); |
|
| 142 | + $paymentdateafter = dol_stringtotime($argv[$key + 1].'000000'); |
|
| 143 | + $paymentdatebefore = dol_stringtotime($argv[$key + 2].'235959'); |
|
| 144 | 144 | if (empty($paymentdateafter) || empty($paymentdatebefore)) { |
| 145 | - print 'Error: Bad date format or value' . "\n"; |
|
| 145 | + print 'Error: Bad date format or value'."\n"; |
|
| 146 | 146 | exit(-1); |
| 147 | 147 | } |
| 148 | - print 'Rebuild PDF for invoices with at least one payment between ' . dol_print_date($paymentdateafter, 'day', 'gmt') . " and " . dol_print_date($paymentdatebefore, 'day', 'gmt') . ".\n"; |
|
| 148 | + print 'Rebuild PDF for invoices with at least one payment between '.dol_print_date($paymentdateafter, 'day', 'gmt')." and ".dol_print_date($paymentdatebefore, 'day', 'gmt').".\n"; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | if ($value == 'filter=nopayment') { |
| 152 | 152 | $found = true; |
| 153 | - $option .= (empty($option) ? '' : '_') . 'nopayment'; |
|
| 153 | + $option .= (empty($option) ? '' : '_').'nopayment'; |
|
| 154 | 154 | $filter[] = 'nopayment'; |
| 155 | 155 | |
| 156 | - print 'Rebuild PDF for invoices with no payment done yet.' . "\n"; |
|
| 156 | + print 'Rebuild PDF for invoices with no payment done yet.'."\n"; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if ($value == 'filter=bank') { |
| 160 | 160 | $found = true; |
| 161 | - $option .= (empty($option) ? '' : '_') . 'bank_' . $argv[$key + 1]; |
|
| 161 | + $option .= (empty($option) ? '' : '_').'bank_'.$argv[$key + 1]; |
|
| 162 | 162 | $filter[] = 'bank'; |
| 163 | 163 | |
| 164 | 164 | $paymentonbankref = $argv[$key + 1]; |
| 165 | 165 | $bankaccount = new Account($db); |
| 166 | 166 | $result = $bankaccount->fetch(0, $paymentonbankref); |
| 167 | 167 | if ($result <= 0) { |
| 168 | - print 'Error: Bank account with ref "' . $paymentonbankref . '" not found' . "\n"; |
|
| 168 | + print 'Error: Bank account with ref "'.$paymentonbankref.'" not found'."\n"; |
|
| 169 | 169 | exit(-1); |
| 170 | 170 | } |
| 171 | 171 | $paymentonbankid = $bankaccount->id; |
| 172 | - print 'Rebuild PDF for invoices with at least one payment on financial account ' . $bankaccount->ref . "\n"; |
|
| 172 | + print 'Rebuild PDF for invoices with at least one payment on financial account '.$bankaccount->ref."\n"; |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | if ($value == 'filter=nodeposit') { |
| 176 | 176 | $found = true; |
| 177 | - $option .= (empty($option) ? '' : '_') . 'nodeposit'; |
|
| 177 | + $option .= (empty($option) ? '' : '_').'nodeposit'; |
|
| 178 | 178 | $filter[] = 'nodeposit'; |
| 179 | 179 | |
| 180 | - print 'Exclude deposit invoices' . "\n"; |
|
| 180 | + print 'Exclude deposit invoices'."\n"; |
|
| 181 | 181 | } |
| 182 | 182 | if ($value == 'filter=noreplacement') { |
| 183 | 183 | $found = true; |
| 184 | - $option .= (empty($option) ? '' : '_') . 'noreplacement'; |
|
| 184 | + $option .= (empty($option) ? '' : '_').'noreplacement'; |
|
| 185 | 185 | $filter[] = 'noreplacement'; |
| 186 | 186 | |
| 187 | - print 'Exclude replacement invoices' . "\n"; |
|
| 187 | + print 'Exclude replacement invoices'."\n"; |
|
| 188 | 188 | } |
| 189 | 189 | if ($value == 'filter=nocreditnote') { |
| 190 | 190 | $found = true; |
| 191 | - $option .= (empty($option) ? '' : '_') . 'nocreditnote'; |
|
| 191 | + $option .= (empty($option) ? '' : '_').'nocreditnote'; |
|
| 192 | 192 | $filter[] = 'nocreditnote'; |
| 193 | 193 | |
| 194 | - print 'Exclude credit note invoices' . "\n"; |
|
| 194 | + print 'Exclude credit note invoices'."\n"; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | if ($value == 'filter=excludethirdparties') { |
@@ -199,18 +199,18 @@ discard block |
||
| 199 | 199 | $filter[] = 'excludethirdparties'; |
| 200 | 200 | |
| 201 | 201 | $thirdpartiesid = explode(',', $argv[$key + 1]); |
| 202 | - print 'Exclude thirdparties with id in list (' . join(',', $thirdpartiesid) . ").\n"; |
|
| 202 | + print 'Exclude thirdparties with id in list ('.join(',', $thirdpartiesid).").\n"; |
|
| 203 | 203 | |
| 204 | - $option .= (empty($option) ? '' : '_') . 'excludethirdparties' . join('-', $thirdpartiesid); |
|
| 204 | + $option .= (empty($option) ? '' : '_').'excludethirdparties'.join('-', $thirdpartiesid); |
|
| 205 | 205 | } |
| 206 | 206 | if ($value == 'filter=onlythirdparties') { |
| 207 | 207 | $found = true; |
| 208 | 208 | $filter[] = 'onlythirdparties'; |
| 209 | 209 | |
| 210 | 210 | $thirdpartiesid = explode(',', $argv[$key + 1]); |
| 211 | - print 'Only thirdparties with id in list (' . join(',', $thirdpartiesid) . ").\n"; |
|
| 211 | + print 'Only thirdparties with id in list ('.join(',', $thirdpartiesid).").\n"; |
|
| 212 | 212 | |
| 213 | - $option .= (empty($option) ? '' : '_') . 'onlythirdparty' . join('-', $thirdpartiesid); |
|
| 213 | + $option .= (empty($option) ? '' : '_').'onlythirdparty'.join('-', $thirdpartiesid); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | if (!$found && preg_match('/filter=/i', $value)) { |
@@ -242,10 +242,10 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | if ($result >= 0) { |
| 244 | 244 | $error = 0; |
| 245 | - print '--- end ok' . "\n"; |
|
| 245 | + print '--- end ok'."\n"; |
|
| 246 | 246 | } else { |
| 247 | 247 | $error = $result; |
| 248 | - print '--- end error code=' . $error . "\n"; |
|
| 248 | + print '--- end error code='.$error."\n"; |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | $db->close(); |
@@ -264,15 +264,15 @@ discard block |
||
| 264 | 264 | print "Rebuild PDF files for some invoices and merge PDF files into one.\n"; |
| 265 | 265 | print "\n"; |
| 266 | 266 | print "To build/merge PDF for invoices in a date range:\n"; |
| 267 | - print "Usage: " . $script_file . " filter=date dateafter datebefore\n"; |
|
| 267 | + print "Usage: ".$script_file." filter=date dateafter datebefore\n"; |
|
| 268 | 268 | print "To build/merge PDF for invoices with at least one payment in a date range:\n"; |
| 269 | - print "Usage: " . $script_file . " filter=payments dateafter datebefore\n"; |
|
| 269 | + print "Usage: ".$script_file." filter=payments dateafter datebefore\n"; |
|
| 270 | 270 | print "To build/merge PDF for invoices with at least one payment onto a bank account:\n"; |
| 271 | - print "Usage: " . $script_file . " filter=bank bankref\n"; |
|
| 271 | + print "Usage: ".$script_file." filter=bank bankref\n"; |
|
| 272 | 272 | print "To build/merge PDF for all invoices, use filter=all\n"; |
| 273 | - print "Usage: " . $script_file . " filter=all\n"; |
|
| 273 | + print "Usage: ".$script_file." filter=all\n"; |
|
| 274 | 274 | print "To build/merge PDF for invoices with no payments, use filter=nopayment\n"; |
| 275 | - print "Usage: " . $script_file . " filter=nopayment\n"; |
|
| 275 | + print "Usage: ".$script_file." filter=nopayment\n"; |
|
| 276 | 276 | print "To exclude credit notes, use filter=nocreditnote\n"; |
| 277 | 277 | print "To exclude replacement invoices, use filter=noreplacement\n"; |
| 278 | 278 | print "To exclude deposit invoices, use filter=nodeposit\n"; |
@@ -282,8 +282,8 @@ discard block |
||
| 282 | 282 | print "To generate invoices in a language, use lang=xx_XX\n"; |
| 283 | 283 | print "To set prefix of generated file name, use prefix=myfileprefix\n"; |
| 284 | 284 | print "\n"; |
| 285 | - print "Example: " . $script_file . " filter=payments 20080101 20081231 lang=fr_FR regenerate=crabe\n"; |
|
| 286 | - print "Example: " . $script_file . " filter=all lang=en_US\n"; |
|
| 285 | + print "Example: ".$script_file." filter=payments 20080101 20081231 lang=fr_FR regenerate=crabe\n"; |
|
| 286 | + print "Example: ".$script_file." filter=all lang=en_US\n"; |
|
| 287 | 287 | print "\n"; |
| 288 | 288 | print "Note that some filters can be cumulated.\n"; |
| 289 | 289 | } |