@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | class Bbb |
| 20 | 20 | { |
| 21 | - const BBB='bbb'; |
|
| 21 | + const BBB = 'bbb'; |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * do |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | global $globalaaa, $globalbbb; |
| 31 | 31 | echo 'dobbb'."\n"; |
| 32 | - $globalaaa.='+bbb'; |
|
| 33 | - $globalbbb.='+bbb'; |
|
| 32 | + $globalaaa .= '+bbb'; |
|
| 33 | + $globalbbb .= '+bbb'; |
|
| 34 | 34 | } |
| 35 | 35 | } |
@@ -25,9 +25,11 @@ |
||
| 25 | 25 | * |
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | - public function do() |
|
| 28 | + public function do { |
|
| 29 | + () |
|
| 29 | 30 | { |
| 30 | 31 | global $globalaaa, $globalbbb; |
| 32 | + } |
|
| 31 | 33 | echo 'dobbb'."\n"; |
| 32 | 34 | $globalaaa.='+bbb'; |
| 33 | 35 | $globalbbb.='+bbb'; |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class Aaa |
| 22 | 22 | { |
| 23 | - const AAA='aaa'; |
|
| 23 | + const AAA = 'aaa'; |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * do |
@@ -27,8 +27,10 @@ |
||
| 27 | 27 | * |
| 28 | 28 | * @return void |
| 29 | 29 | */ |
| 30 | - public function do() |
|
| 30 | + public function do { |
|
| 31 | + () |
|
| 31 | 32 | { |
| 32 | 33 | echo 'doaaa'."\n"; |
| 33 | 34 | } |
| 35 | + } |
|
| 34 | 36 | } |
@@ -65,11 +65,11 @@ |
||
| 65 | 65 | - To convert pfx certificate to pem: openssl pkcs12 -in tcpdf.pfx -out tcpdf.crt -nodes |
| 66 | 66 | |
| 67 | 67 | */ |
| 68 | -$permissions=array('copy'); |
|
| 69 | -$user_pass='aaa'; |
|
| 70 | -$owner_pass=null; |
|
| 71 | -$mode=0; |
|
| 72 | -$pubkeys=null; |
|
| 68 | +$permissions = array('copy'); |
|
| 69 | +$user_pass = 'aaa'; |
|
| 70 | +$owner_pass = null; |
|
| 71 | +$mode = 0; |
|
| 72 | +$pubkeys = null; |
|
| 73 | 73 | $pdf->SetProtection($permissions, $user_pass, $owner_pass, $mode, $pubkeys); |
| 74 | 74 | |
| 75 | 75 | // Example with public-key |
@@ -123,7 +123,7 @@ |
||
| 123 | 123 | Encryption Example |
| 124 | 124 | |
| 125 | 125 | Consult the source code documentation for the SetProtection() method. |
| 126 | -EOD; |
|
| 126 | +eod; |
|
| 127 | 127 | |
| 128 | 128 | // print a block of text using Write() |
| 129 | 129 | $pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); |
@@ -149,13 +149,13 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | // key is redundant |
| 151 | 151 | if (array_key_exists($key, $aSecondary)) { |
| 152 | - print "Key $key is redundant in file $lSecondaryFile (line: $cnt).\n"; |
|
| 152 | + print "key $key is redundant in file $lSecondaryFile (line: $cnt).\n"; |
|
| 153 | 153 | continue; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // String has no value |
| 157 | 157 | if ($value == '') { |
| 158 | - print "Key $key has no value in file $lSecondaryFile (line: $cnt).\n"; |
|
| 158 | + print "key $key has no value in file $lSecondaryFile (line: $cnt).\n"; |
|
| 159 | 159 | continue; |
| 160 | 160 | } |
| 161 | 161 | |
@@ -203,13 +203,13 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | // key is redundant |
| 205 | 205 | if (array_key_exists($key, $aEnglish)) { |
| 206 | - print "Key $key is redundant in file $lEnglishFile (line: $cnt).\n"; |
|
| 206 | + print "key $key is redundant in file $lEnglishFile (line: $cnt).\n"; |
|
| 207 | 207 | continue; |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | // String has no value |
| 211 | 211 | if ($value == '') { |
| 212 | - print "Key $key has no value in file $lEnglishFile (line: $cnt).\n"; |
|
| 212 | + print "key $key has no value in file $lEnglishFile (line: $cnt).\n"; |
|
| 213 | 213 | continue; |
| 214 | 214 | } |
| 215 | 215 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | // key is redundant |
| 274 | 274 | if (array_key_exists($key, $aPrimary)) { |
| 275 | - print "Key $key is redundant in file $lPrimaryFile (line: $cnt) - Already found into ".$fileFirstFound[$key]." (line: ".$lineFirstFound[$key].").\n"; |
|
| 275 | + print "key $key is redundant in file $lPrimaryFile (line: $cnt) - Already found into ".$fileFirstFound[$key]." (line: ".$lineFirstFound[$key].").\n"; |
|
| 276 | 276 | continue; |
| 277 | 277 | } else { |
| 278 | 278 | $fileFirstFound[$key] = $fileToProcess; |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | // String has no value |
| 283 | 283 | if ($value == '') { |
| 284 | - print "Key $key has no value in file $lPrimaryFile (line: $cnt).\n"; |
|
| 284 | + print "key $key has no value in file $lPrimaryFile (line: $cnt).\n"; |
|
| 285 | 285 | continue; |
| 286 | 286 | } |
| 287 | 287 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | $sapi_type = php_sapi_name(); |
| 48 | 48 | $script_file = basename(__FILE__); |
| 49 | -$path=dirname(__FILE__).'/'; |
|
| 49 | +$path = dirname(__FILE__).'/'; |
|
| 50 | 50 | |
| 51 | 51 | // Test if batch mode |
| 52 | 52 | if (substr($sapi_type, 0, 3) == 'cgi') { |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | if (empty($lPrimary) || empty($lSecondary) || empty($filesToProcess)) { |
| 67 | 67 | $rc = 1; |
| 68 | 68 | $msg = '***** Script to clean language files *****'."\n"; |
| 69 | - $msg.= 'Usage: ./dev/translation/strip_language_file.php xx_XX xx_YY [file.lang|all]'."\n"; |
|
| 70 | - print $msg . "(rc=$rc).\n"; |
|
| 69 | + $msg .= 'Usage: ./dev/translation/strip_language_file.php xx_XX xx_YY [file.lang|all]'."\n"; |
|
| 70 | + print $msg."(rc=$rc).\n"; |
|
| 71 | 71 | exit($rc); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | if ($filesToProcess == 'all') { |
| 80 | 80 | $dir = new DirectoryIterator('htdocs/langs/'.$lPrimary); |
| 81 | 81 | while ($dir->valid()) { |
| 82 | - if (!$dir->isDot() && $dir->isFile() && ! preg_match('/^\./', $dir->getFilename())) { |
|
| 83 | - $files[] = $dir->getFilename(); |
|
| 82 | + if (!$dir->isDot() && $dir->isFile() && !preg_match('/^\./', $dir->getFilename())) { |
|
| 83 | + $files[] = $dir->getFilename(); |
|
| 84 | 84 | } |
| 85 | 85 | $dir->next(); |
| 86 | 86 | } |
| 87 | - $filesToProcess=$files; |
|
| 87 | + $filesToProcess = $files; |
|
| 88 | 88 | } else { |
| 89 | - $filesToProcess=explode(',', $filesToProcess); |
|
| 89 | + $filesToProcess = explode(',', $filesToProcess); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | // Arguments should be OK here. |
@@ -97,28 +97,28 @@ discard block |
||
| 97 | 97 | $lPrimaryFile = 'htdocs/langs/'.$lPrimary.'/'.$fileToProcess; |
| 98 | 98 | $lSecondaryFile = 'htdocs/langs/'.$lSecondary.'/'.$fileToProcess; |
| 99 | 99 | $lEnglishFile = 'htdocs/langs/'.$lEnglish.'/'.$fileToProcess; |
| 100 | - $output = $lSecondaryFile . '.delta'; |
|
| 100 | + $output = $lSecondaryFile.'.delta'; |
|
| 101 | 101 | |
| 102 | 102 | print "---- Process language file ".$lSecondaryFile."\n"; |
| 103 | 103 | |
| 104 | - if (! is_readable($lPrimaryFile)) { |
|
| 104 | + if (!is_readable($lPrimaryFile)) { |
|
| 105 | 105 | $rc = 2; |
| 106 | 106 | $msg = "Cannot read primary language file $lPrimaryFile."; |
| 107 | - print $msg . " (rc=$rc).\n"; |
|
| 107 | + print $msg." (rc=$rc).\n"; |
|
| 108 | 108 | exit($rc); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - if (! is_readable($lSecondaryFile)) { |
|
| 111 | + if (!is_readable($lSecondaryFile)) { |
|
| 112 | 112 | $rc = 3; |
| 113 | 113 | $msg = "Cannot read secondary language file $lSecondaryFile. We discard this file."; |
| 114 | - print $msg . "\n"; |
|
| 114 | + print $msg."\n"; |
|
| 115 | 115 | continue; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if (! is_readable($lEnglishFile)) { |
|
| 118 | + if (!is_readable($lEnglishFile)) { |
|
| 119 | 119 | $rc = 3; |
| 120 | 120 | $msg = "Cannot read english language file $lEnglishFile. We discard this file."; |
| 121 | - print $msg . "\n"; |
|
| 121 | + print $msg."\n"; |
|
| 122 | 122 | continue; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | $a = mb_split('=', trim($line), 2); |
| 143 | 143 | if (count($a) != 2) { |
| 144 | - print "ERROR in file $lSecondaryFile, line $cnt: " . trim($line) . "\n"; |
|
| 144 | + print "ERROR in file $lSecondaryFile, line $cnt: ".trim($line)."\n"; |
|
| 145 | 145 | continue; |
| 146 | 146 | } |
| 147 | 147 | |
@@ -161,17 +161,17 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | $aSecondary[$key] = trim($value); |
| 163 | 163 | } |
| 164 | - if (! feof($handle)) { |
|
| 164 | + if (!feof($handle)) { |
|
| 165 | 165 | $rc = 5; |
| 166 | 166 | $msg = "Unexpected fgets() fail"; |
| 167 | - print $msg . " (rc=$rc).\n"; |
|
| 167 | + print $msg." (rc=$rc).\n"; |
|
| 168 | 168 | exit($rc); |
| 169 | 169 | } |
| 170 | 170 | fclose($handle); |
| 171 | 171 | } else { |
| 172 | 172 | $rc = 6; |
| 173 | 173 | $msg = "Cannot open file $lSecondaryFile"; |
| 174 | - print $msg . " (rc=$rc).\n"; |
|
| 174 | + print $msg." (rc=$rc).\n"; |
|
| 175 | 175 | exit($rc); |
| 176 | 176 | } |
| 177 | 177 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | $a = mb_split('=', trim($line), 2); |
| 197 | 197 | if (count($a) != 2) { |
| 198 | - print "ERROR in file $lEnglishFile, line $cnt: " . trim($line) . "\n"; |
|
| 198 | + print "ERROR in file $lEnglishFile, line $cnt: ".trim($line)."\n"; |
|
| 199 | 199 | continue; |
| 200 | 200 | } |
| 201 | 201 | |
@@ -215,17 +215,17 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | $aEnglish[$key] = trim($value); |
| 217 | 217 | } |
| 218 | - if (! feof($handle)) { |
|
| 218 | + if (!feof($handle)) { |
|
| 219 | 219 | $rc = 5; |
| 220 | 220 | $msg = "Unexpected fgets() fail"; |
| 221 | - print $msg . " (rc=$rc).\n"; |
|
| 221 | + print $msg." (rc=$rc).\n"; |
|
| 222 | 222 | exit($rc); |
| 223 | 223 | } |
| 224 | 224 | fclose($handle); |
| 225 | 225 | } else { |
| 226 | 226 | $rc = 6; |
| 227 | 227 | $msg = "Cannot open file $lEnglishFile"; |
| 228 | - print $msg . " (rc=$rc).\n"; |
|
| 228 | + print $msg." (rc=$rc).\n"; |
|
| 229 | 229 | exit($rc); |
| 230 | 230 | } |
| 231 | 231 | |
@@ -233,11 +233,11 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | // Start reading and parsing Primary. See rules in header! |
| 235 | 235 | |
| 236 | - $arrayofkeytoalwayskeep=array('DIRECTION','FONTFORPDF','FONTSIZEFORPDF','SeparatorDecimal','SeparatorThousand'); |
|
| 236 | + $arrayofkeytoalwayskeep = array('DIRECTION', 'FONTFORPDF', 'FONTSIZEFORPDF', 'SeparatorDecimal', 'SeparatorThousand'); |
|
| 237 | 237 | |
| 238 | 238 | |
| 239 | 239 | if ($handle = fopen($lPrimaryFile, 'r')) { |
| 240 | - if (! $oh = fopen($output, 'w')) { |
|
| 240 | + if (!$oh = fopen($output, 'w')) { |
|
| 241 | 241 | print "ERROR in writing to file ".$output."\n"; |
| 242 | 242 | exit; |
| 243 | 243 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | $a = mb_split('=', trim($line), 2); |
| 266 | 266 | if (count($a) != 2) { |
| 267 | - print "ERROR in file $lPrimaryFile, line $cnt: " . trim($line) . "\n"; |
|
| 267 | + print "ERROR in file $lPrimaryFile, line $cnt: ".trim($line)."\n"; |
|
| 268 | 268 | continue; |
| 269 | 269 | } |
| 270 | 270 | |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | // Key not in other file |
| 297 | 297 | if (in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/', $key) || preg_match('/^FormatHour/', $key)) { |
| 298 | 298 | //print "Key $key is a key we always want to see into secondary file (line: $cnt).\n"; |
| 299 | - } elseif (! array_key_exists($key, $aSecondary)) { |
|
| 299 | + } elseif (!array_key_exists($key, $aSecondary)) { |
|
| 300 | 300 | //print "Key $key does NOT exist in secondary language (line: $cnt).\n"; |
| 301 | 301 | continue; |
| 302 | 302 | } |
@@ -311,10 +311,10 @@ discard block |
||
| 311 | 311 | fwrite($oh, $key."=".(empty($aSecondary[$key]) ? $aPrimary[$key] : $aSecondary[$key])."\n"); |
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | - if (! feof($handle)) { |
|
| 314 | + if (!feof($handle)) { |
|
| 315 | 315 | $rc = 7; |
| 316 | 316 | $msg = "Unexpected fgets() fail"; |
| 317 | - print $msg . " (rc=$rc).\n"; |
|
| 317 | + print $msg." (rc=$rc).\n"; |
|
| 318 | 318 | exit($rc); |
| 319 | 319 | } |
| 320 | 320 | fclose($oh); |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | } else { |
| 323 | 323 | $rc = 8; |
| 324 | 324 | $msg = "Cannot open file $lPrimaryFile"; |
| 325 | - print $msg . " (rc=$rc).\n"; |
|
| 325 | + print $msg." (rc=$rc).\n"; |
|
| 326 | 326 | exit($rc); |
| 327 | 327 | } |
| 328 | 328 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $sapi_type = php_sapi_name(); |
| 30 | 30 | $script_file = basename(__FILE__); |
| 31 | -$path=dirname(__FILE__).'/'; |
|
| 31 | +$path = dirname(__FILE__).'/'; |
|
| 32 | 32 | |
| 33 | 33 | // Test if batch mode |
| 34 | 34 | if (substr($sapi_type, 0, 3) == 'cgi') { |
@@ -45,17 +45,17 @@ discard block |
||
| 45 | 45 | $langs->load("main"); |
| 46 | 46 | |
| 47 | 47 | // Global variables |
| 48 | -$version='1.14'; |
|
| 49 | -$error=0; |
|
| 48 | +$version = '1.14'; |
|
| 49 | +$error = 0; |
|
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | // -------------------- START OF YOUR CODE HERE -------------------- |
| 53 | 53 | @set_time_limit(0); |
| 54 | 54 | print "***** ".$script_file." (".$version.") *****\n"; |
| 55 | -$dir=DOL_DOCUMENT_ROOT."/langs"; |
|
| 55 | +$dir = DOL_DOCUMENT_ROOT."/langs"; |
|
| 56 | 56 | |
| 57 | 57 | // Check parameters |
| 58 | -if (! isset($argv[3])) { |
|
| 58 | +if (!isset($argv[3])) { |
|
| 59 | 59 | print "Usage: ".$script_file." lang_code_src lang_code_dest|all APIKEY [langfile.lang]\n"; |
| 60 | 60 | print "Example: ".$script_file." en_US pt_PT 123456\n"; |
| 61 | 61 | print "Rem: lang_code to use can be found on https://translate.google.com\n"; |
@@ -66,18 +66,18 @@ discard block |
||
| 66 | 66 | print 'Argument 1='.$argv[1]."\n"; |
| 67 | 67 | print 'Argument 2='.$argv[2]."\n"; |
| 68 | 68 | print 'Argument 3='.$argv[3]."\n"; |
| 69 | -$file=''; |
|
| 69 | +$file = ''; |
|
| 70 | 70 | if (isset($argv[4])) { |
| 71 | - $file=$argv[4]; |
|
| 71 | + $file = $argv[4]; |
|
| 72 | 72 | print 'Argument 4='.$argv[4]."\n"; |
| 73 | 73 | } |
| 74 | 74 | print 'Files will be generated/updated in directory '.$dir."\n"; |
| 75 | 75 | |
| 76 | 76 | if ($argv[2] != 'all') { |
| 77 | - if (! is_dir($dir.'/'.$argv[2])) { |
|
| 77 | + if (!is_dir($dir.'/'.$argv[2])) { |
|
| 78 | 78 | print 'Create directory '.$dir.'/'.$argv[2]."\n"; |
| 79 | - $result=mkdir($dir.'/'.$argv[2]); |
|
| 80 | - if (! $result) { |
|
| 79 | + $result = mkdir($dir.'/'.$argv[2]); |
|
| 80 | + if (!$result) { |
|
| 81 | 81 | $db->close(); |
| 82 | 82 | return -1; |
| 83 | 83 | } |
@@ -105,7 +105,7 @@ |
||
| 105 | 105 | |
| 106 | 106 | print "Generates ".GEN_NUMBER_SOCIETE." companies\n"; |
| 107 | 107 | for ($s = 0; $s < GEN_NUMBER_SOCIETE; $s++) { |
| 108 | - print "Company $s\n"; |
|
| 108 | + print "company $s\n"; |
|
| 109 | 109 | $soc = new Societe($db); |
| 110 | 110 | $soc->name = "Company num ".time()."$s"; |
| 111 | 111 | $soc->town = $listoftown[mt_rand(0, count($listoftown)-1)]; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | $sapi_type = php_sapi_name(); |
| 28 | 28 | $script_file = basename(__FILE__); |
| 29 | -$path=dirname(__FILE__).'/'; |
|
| 29 | +$path = dirname(__FILE__).'/'; |
|
| 30 | 30 | |
| 31 | 31 | // Test si mode batch |
| 32 | 32 | $sapi_type = php_sapi_name(); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | // Recupere root dolibarr |
| 39 | 39 | //$path=preg_replace('/generate-societe.php/i','',$_SERVER["PHP_SELF"]); |
| 40 | -require __DIR__. '/../../htdocs/master.inc.php'; |
|
| 40 | +require __DIR__.'/../../htdocs/master.inc.php'; |
|
| 41 | 41 | include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
| 42 | 42 | include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
| 43 | 43 | include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; |
| 46 | 46 | include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
| 47 | 47 | |
| 48 | -$listoftown = array("Auray","Baden","Vannes","Pirouville","Haguenau","Souffelweiersheim","Illkirch-Graffenstaden","Lauterbourg","Picauville","Sainte-Mère Eglise","Le Bono"); |
|
| 49 | -$listoflastname = array("Joe","Marc","Steve","Laurent","Nico","Isabelle","Dorothee","Saby","Brigitte","Karine","Jose-Anne","Celine","Virginie"); |
|
| 48 | +$listoftown = array("Auray", "Baden", "Vannes", "Pirouville", "Haguenau", "Souffelweiersheim", "Illkirch-Graffenstaden", "Lauterbourg", "Picauville", "Sainte-Mère Eglise", "Le Bono"); |
|
| 49 | +$listoflastname = array("Joe", "Marc", "Steve", "Laurent", "Nico", "Isabelle", "Dorothee", "Saby", "Brigitte", "Karine", "Jose-Anne", "Celine", "Virginie"); |
|
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | /* |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | define('GEN_NUMBER_SOCIETE', $argv[1] ?? 10); |
| 57 | 57 | |
| 58 | 58 | |
| 59 | -$ret=$user->fetch('', 'admin'); |
|
| 60 | -if (! $ret > 0) { |
|
| 59 | +$ret = $user->fetch('', 'admin'); |
|
| 60 | +if (!$ret > 0) { |
|
| 61 | 61 | print 'A user with login "admin" and all permissions must be created to use this script.'."\n"; |
| 62 | 62 | exit; |
| 63 | 63 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array(); |
| 68 | -$resql=$db->query($sql); |
|
| 68 | +$resql = $db->query($sql); |
|
| 69 | 69 | if ($resql) { |
| 70 | 70 | $num = $db->num_rows($resql); |
| 71 | 71 | $i = 0; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array(); |
| 80 | -$resql=$db->query($sql); |
|
| 80 | +$resql = $db->query($sql); |
|
| 81 | 81 | if ($resql) { |
| 82 | 82 | $num = $db->num_rows($resql); |
| 83 | 83 | $i = 0; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $commandesid = array(); |
| 94 | -$resql=$db->query($sql); |
|
| 94 | +$resql = $db->query($sql); |
|
| 95 | 95 | if ($resql) { |
| 96 | 96 | $num = $db->num_rows($resql); |
| 97 | 97 | $i = 0; |
@@ -111,18 +111,18 @@ discard block |
||
| 111 | 111 | print "Company $s\n"; |
| 112 | 112 | $soc = new Societe($db); |
| 113 | 113 | $soc->name = "Company num ".time()."$s"; |
| 114 | - $soc->town = $listoftown[mt_rand(0, count($listoftown)-1)]; |
|
| 115 | - $soc->client = mt_rand(1, 2); // Une societe sur 2 est prospect, l'autre client |
|
| 116 | - $soc->fournisseur = mt_rand(0, 1); // Une societe sur 2 est fournisseur |
|
| 117 | - $soc->code_client='CU'.time()."$s"; |
|
| 118 | - $soc->code_fournisseur='SU'.time()."$s"; |
|
| 119 | - $soc->tva_assuj=1; |
|
| 120 | - $soc->country_id=1; |
|
| 121 | - $soc->country_code='FR'; |
|
| 114 | + $soc->town = $listoftown[mt_rand(0, count($listoftown) - 1)]; |
|
| 115 | + $soc->client = mt_rand(1, 2); // Une societe sur 2 est prospect, l'autre client |
|
| 116 | + $soc->fournisseur = mt_rand(0, 1); // Une societe sur 2 est fournisseur |
|
| 117 | + $soc->code_client = 'CU'.time()."$s"; |
|
| 118 | + $soc->code_fournisseur = 'SU'.time()."$s"; |
|
| 119 | + $soc->tva_assuj = 1; |
|
| 120 | + $soc->country_id = 1; |
|
| 121 | + $soc->country_code = 'FR'; |
|
| 122 | 122 | // Un client sur 3 a une remise de 5% |
| 123 | - $user_remise=mt_rand(1, 3); |
|
| 124 | - if ($user_remise==3) { |
|
| 125 | - $soc->remise_percent=5; |
|
| 123 | + $user_remise = mt_rand(1, 3); |
|
| 124 | + if ($user_remise == 3) { |
|
| 125 | + $soc->remise_percent = 5; |
|
| 126 | 126 | } |
| 127 | 127 | print "> client=".$soc->client.", fournisseur=".$soc->fournisseur.", remise=".$soc->remise_percent."\n"; |
| 128 | 128 | $soc->note_private = 'Company created by the script generate-societe.php'; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $contact = new Contact($db); |
| 136 | 136 | $contact->socid = $soc->id; |
| 137 | 137 | $contact->lastname = "Lastname".$c; |
| 138 | - $contact->firstname = $listoflastname[mt_rand(0, count($listoflastname)-1)]; |
|
| 138 | + $contact->firstname = $listoflastname[mt_rand(0, count($listoflastname) - 1)]; |
|
| 139 | 139 | if ($contact->create($user)) { |
| 140 | 140 | } |
| 141 | 141 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | $sapi_type = php_sapi_name(); |
| 28 | 28 | $script_file = basename(__FILE__); |
| 29 | -$path=__DIR__.'/'; |
|
| 29 | +$path = __DIR__.'/'; |
|
| 30 | 30 | |
| 31 | 31 | // Test si mode batch |
| 32 | 32 | if (substr($sapi_type, 0, 3) == 'cgi') { |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | // Recupere root dolibarr |
| 38 | -$path=preg_replace('/purge-data.php/i', '', $_SERVER["PHP_SELF"]); |
|
| 38 | +$path = preg_replace('/purge-data.php/i', '', $_SERVER["PHP_SELF"]); |
|
| 39 | 39 | require $path."../../htdocs/master.inc.php"; |
| 40 | 40 | include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
| 41 | 41 | include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | $langs->loadLangs(array("main", "errors")); |
| 48 | 48 | |
| 49 | 49 | // Global variables |
| 50 | -$version=DOL_VERSION; |
|
| 51 | -$error=0; |
|
| 50 | +$version = DOL_VERSION; |
|
| 51 | +$error = 0; |
|
| 52 | 52 | |
| 53 | 53 | // List of sql to execute |
| 54 | -$sqls=array( |
|
| 54 | +$sqls = array( |
|
| 55 | 55 | 'user'=>array( |
| 56 | 56 | "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user IN (SELECT rowid FROM ".MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin') AND fk_user IN (select rowid FROM ".MAIN_DB_PREFIX."user where datec < '__DATE__')", |
| 57 | 57 | "DELETE FROM ".MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin' AND datec < '__DATE__'", |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $option = $argv[2]; |
| 183 | 183 | $date = $argv[3]; |
| 184 | 184 | |
| 185 | -if (empty($mode) || ! in_array($mode, array('test','confirm'))) { |
|
| 185 | +if (empty($mode) || !in_array($mode, array('test', 'confirm'))) { |
|
| 186 | 186 | print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; |
| 187 | 187 | print "\n"; |
| 188 | 188 | print "option can be ".implode(',', array_keys($sqls))."\n"; |
@@ -195,9 +195,9 @@ discard block |
||
| 195 | 195 | exit(-1); |
| 196 | 196 | } |
| 197 | 197 | if ($option != 'all') { |
| 198 | - $listofoptions=explode(',', $option); |
|
| 198 | + $listofoptions = explode(',', $option); |
|
| 199 | 199 | foreach ($listofoptions as $cursoroption) { |
| 200 | - if (! in_array($cursoroption, array_keys($sqls))) { |
|
| 200 | + if (!in_array($cursoroption, array_keys($sqls))) { |
|
| 201 | 201 | print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; |
| 202 | 202 | print "\n"; |
| 203 | 203 | print "option '".$cursoroption."' must be in list ".implode(',', array_keys($sqls))."\n"; |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | -if (empty($date) || (! preg_match('/\d\d\d\d\-\d\d\-\d\d$/', $date) && $date != 'all')) { |
|
| 209 | +if (empty($date) || (!preg_match('/\d\d\d\d\-\d\d\-\d\d$/', $date) && $date != 'all')) { |
|
| 210 | 210 | print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; |
| 211 | 211 | print "\n"; |
| 212 | 212 | print "date can be 'all' or 'YYYY-MM-DD' to delete record before YYYY-MM-DD\n"; |
@@ -221,13 +221,13 @@ discard block |
||
| 221 | 221 | if (!empty($argv[4])) { |
| 222 | 222 | $db->close(); |
| 223 | 223 | unset($db); |
| 224 | - $db=getDoliDBInstance($argv[4], $argv[5], $argv[6], $argv[7], $argv[8], $argv[9]); |
|
| 225 | - $user=new User($db); |
|
| 224 | + $db = getDoliDBInstance($argv[4], $argv[5], $argv[6], $argv[7], $argv[8], $argv[9]); |
|
| 225 | + $user = new User($db); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | //var_dump($user->db->database_name); |
| 229 | -$ret=$user->fetch('', 'admin'); |
|
| 230 | -if (! $ret > 0) { |
|
| 229 | +$ret = $user->fetch('', 'admin'); |
|
| 230 | +if (!$ret > 0) { |
|
| 231 | 231 | print 'An admin user with login "admin" must exists to use this script.'."\n"; |
| 232 | 232 | exit; |
| 233 | 233 | } |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | print "User = ".$db->database_user."\n"; |
| 243 | 243 | print "\n"; |
| 244 | 244 | |
| 245 | -if (! $confirmed) { |
|
| 245 | +if (!$confirmed) { |
|
| 246 | 246 | print "Hit Enter to continue or CTRL+C to stop...\n"; |
| 247 | 247 | $input = trim(fgets(STDIN)); |
| 248 | 248 | } |
@@ -259,10 +259,10 @@ discard block |
||
| 259 | 259 | { |
| 260 | 260 | global $db, $sqls; |
| 261 | 261 | |
| 262 | - $error=0; |
|
| 262 | + $error = 0; |
|
| 263 | 263 | foreach ($sqls[$family] as $sql) { |
| 264 | 264 | if (preg_match('/^@/', $sql)) { |
| 265 | - $newfamily=preg_replace('/@/', '', $sql); |
|
| 265 | + $newfamily = preg_replace('/@/', '', $sql); |
|
| 266 | 266 | processfamily($newfamily, $date); |
| 267 | 267 | continue; |
| 268 | 268 | } |
@@ -271,8 +271,8 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | print "Run sql: ".$sql."\n"; |
| 273 | 273 | |
| 274 | - $resql=$db->query($sql); |
|
| 275 | - if (! $resql) { |
|
| 274 | + $resql = $db->query($sql); |
|
| 275 | + if (!$resql) { |
|
| 276 | 276 | if ($db->errno() != 'DB_ERROR_NOSUCHTABLE') { |
| 277 | 277 | $error++; |
| 278 | 278 | } |
@@ -295,9 +295,9 @@ discard block |
||
| 295 | 295 | |
| 296 | 296 | $db->begin(); |
| 297 | 297 | |
| 298 | -$listofoptions=explode(',', $option); |
|
| 298 | +$listofoptions = explode(',', $option); |
|
| 299 | 299 | foreach ($listofoptions as $cursoroption) { |
| 300 | - $oldfamily=''; |
|
| 300 | + $oldfamily = ''; |
|
| 301 | 301 | foreach ($sqls as $family => $familysql) { |
| 302 | 302 | if ($cursoroption && $cursoroption != 'all' && $cursoroption != $family) { |
| 303 | 303 | continue; |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | } |
| 309 | 309 | $oldfamily = $family; |
| 310 | 310 | |
| 311 | - $result=processfamily($family, $date); |
|
| 311 | + $result = processfamily($family, $date); |
|
| 312 | 312 | if ($result < 0) { |
| 313 | 313 | $error++; |
| 314 | 314 | break; |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | $produit->tva_tx = "20.0"; |
| 107 | 107 | $ret=$produit->create($user); |
| 108 | 108 | if ($ret < 0) { |
| 109 | - print "Error $ret - ".$produit->error."\n"; |
|
| 109 | + print "error $ret - ".$produit->error."\n"; |
|
| 110 | 110 | } else { |
| 111 | 111 | print " OK with ref ".$produit->ref."\n"; |
| 112 | 112 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | $sapi_type = php_sapi_name(); |
| 28 | 28 | $script_file = basename(__FILE__); |
| 29 | -$path=dirname(__FILE__).'/'; |
|
| 29 | +$path = dirname(__FILE__).'/'; |
|
| 30 | 30 | |
| 31 | 31 | // Test si mode batch |
| 32 | 32 | $sapi_type = php_sapi_name(); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | // Recupere root dolibarr |
| 39 | 39 | //$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]); |
| 40 | -require __DIR__. '/../../htdocs/master.inc.php'; |
|
| 40 | +require __DIR__.'/../../htdocs/master.inc.php'; |
|
| 41 | 41 | include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
| 42 | 42 | include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
| 43 | 43 | include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | define('GEN_NUMBER_PRODUIT', $argv[1] ?? 100); |
| 54 | 54 | |
| 55 | 55 | |
| 56 | -$ret=$user->fetch('', 'admin'); |
|
| 57 | -if (! $ret > 0) { |
|
| 56 | +$ret = $user->fetch('', 'admin'); |
|
| 57 | +if (!$ret > 0) { |
|
| 58 | 58 | print 'A user with login "admin" and all permissions must be created to use this script.'."\n"; |
| 59 | 59 | exit; |
| 60 | 60 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array(); |
| 65 | -$resql=$db->query($sql); |
|
| 65 | +$resql = $db->query($sql); |
|
| 66 | 66 | if ($resql) { |
| 67 | 67 | $num = $db->num_rows($resql); |
| 68 | 68 | $i = 0; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array(); |
| 77 | -$resql=$db->query($sql); |
|
| 77 | +$resql = $db->query($sql); |
|
| 78 | 78 | if ($resql) { |
| 79 | 79 | $num = $db->num_rows($resql); |
| 80 | 80 | $i = 0; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $commandesid = array(); |
| 91 | -$resql=$db->query($sql); |
|
| 91 | +$resql = $db->query($sql); |
|
| 92 | 92 | if ($resql) { |
| 93 | 93 | $num = $db->num_rows($resql); |
| 94 | 94 | $i = 0; |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $produit->description = 'Description '.time().$s; |
| 114 | 114 | $produit->price = mt_rand(1, 999.99); |
| 115 | 115 | $produit->tva_tx = "20.0"; |
| 116 | - $ret=$produit->create($user); |
|
| 116 | + $ret = $produit->create($user); |
|
| 117 | 117 | if ($ret < 0) { |
| 118 | 118 | print "Error $ret - ".$produit->error."\n"; |
| 119 | 119 | } else { |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | accessforbidden(); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | -$permissiontoadd = $user->rights->ticket->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles |
|
| 94 | +$permissiontoadd = $user->rights->ticket->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles |
|
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | /* |