@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php |
2 | -$force_install_message='KeepDefaultValuesMamp'; |
|
3 | -$force_install_main_data_root='/Applications/MAMP/dolibarr_documents'; |
|
4 | -$force_install_type='mysqli'; |
|
5 | -$force_install_dbserver='localhost'; |
|
6 | -$force_install_port='8889'; |
|
7 | -$force_install_database='dolibarr'; |
|
8 | -$force_install_createdatabase='1'; |
|
9 | -$force_install_databaselogin='dolibarrmysql'; |
|
10 | -$force_install_databasepass='root'; |
|
11 | -$force_install_createuser='1'; |
|
12 | -$force_install_databaserootlogin='root'; |
|
13 | -$force_install_databaserootpass='root'; |
|
14 | -$force_install_dolibarrlogin='admin'; |
|
15 | -$force_install_nophpinfo='1'; |
|
16 | -$force_install_lockinstall='444'; |
|
2 | +$force_install_message = 'KeepDefaultValuesMamp'; |
|
3 | +$force_install_main_data_root = '/Applications/MAMP/dolibarr_documents'; |
|
4 | +$force_install_type = 'mysqli'; |
|
5 | +$force_install_dbserver = 'localhost'; |
|
6 | +$force_install_port = '8889'; |
|
7 | +$force_install_database = 'dolibarr'; |
|
8 | +$force_install_createdatabase = '1'; |
|
9 | +$force_install_databaselogin = 'dolibarrmysql'; |
|
10 | +$force_install_databasepass = 'root'; |
|
11 | +$force_install_createuser = '1'; |
|
12 | +$force_install_databaserootlogin = 'root'; |
|
13 | +$force_install_databaserootpass = 'root'; |
|
14 | +$force_install_dolibarrlogin = 'admin'; |
|
15 | +$force_install_nophpinfo = '1'; |
|
16 | +$force_install_lockinstall = '444'; |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | * \brief This script create a xml checksum file |
23 | 23 | */ |
24 | 24 | |
25 | -if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db |
|
25 | +if (!defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db |
|
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 if batch mode |
32 | 32 | if (substr($sapi_type, 0, 3) == 'cgi') { |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * Main |
43 | 43 | */ |
44 | 44 | |
45 | -$includecustom=0; |
|
46 | -$includeconstants=array(); |
|
45 | +$includecustom = 0; |
|
46 | +$includeconstants = array(); |
|
47 | 47 | |
48 | 48 | if (empty($argv[1])) |
49 | 49 | { |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | } |
54 | 54 | parse_str($argv[1]); |
55 | 55 | |
56 | -$i=0; |
|
56 | +$i = 0; |
|
57 | 57 | while ($i < $argc) |
58 | 58 | { |
59 | - if (! empty($argv[$i])) parse_str($argv[$i]); |
|
60 | - if (preg_match('/includeconstant=/',$argv[$i])) |
|
59 | + if (!empty($argv[$i])) parse_str($argv[$i]); |
|
60 | + if (preg_match('/includeconstant=/', $argv[$i])) |
|
61 | 61 | { |
62 | - $tmp=explode(':', $includeconstant, 3); |
|
62 | + $tmp = explode(':', $includeconstant, 3); |
|
63 | 63 | if (count($tmp) != 3) |
64 | 64 | { |
65 | 65 | print "Error: Bad parameter includeconstant ".$includeconstant."\n"; |
@@ -80,16 +80,16 @@ discard block |
||
80 | 80 | $savrelease = $release; |
81 | 81 | |
82 | 82 | // If release is auto, we take current version |
83 | -$tmpver=explode('-', $release, 2); |
|
83 | +$tmpver = explode('-', $release, 2); |
|
84 | 84 | if ($tmpver[0] == 'auto' || $tmpver[0] == 'autostable') |
85 | 85 | { |
86 | - $release=DOL_VERSION; |
|
87 | - if ($tmpver[1] && $tmpver[0] == 'auto') $release.='-'.$tmpver[1]; |
|
86 | + $release = DOL_VERSION; |
|
87 | + if ($tmpver[1] && $tmpver[0] == 'auto') $release .= '-'.$tmpver[1]; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | if (empty($includecustom)) |
91 | 91 | { |
92 | - $tmpverbis=explode('-', $release, 2); |
|
92 | + $tmpverbis = explode('-', $release, 2); |
|
93 | 93 | if (empty($tmpverbis[1]) || $tmpver[0] == 'autostable') |
94 | 94 | { |
95 | 95 | if (DOL_VERSION != $tmpverbis[0] && $savrelease != 'auto') |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | else |
103 | 103 | { |
104 | - $tmpverter=explode('-', DOL_VERSION, 2); |
|
104 | + $tmpverter = explode('-', DOL_VERSION, 2); |
|
105 | 105 | if ($tmpverter[0] != $tmpverbis[0]) |
106 | 106 | { |
107 | 107 | print 'Error: When parameter "includecustom" is not set, version declared into filefunc.in.php ('.DOL_VERSION.') must have value without prefix ('.$tmpverter[0].') that is exact same value than "release" parameter ('.$tmpverbis[0].')'."\n"; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | else |
114 | 114 | { |
115 | - if (! preg_match('/'.preg_quote(DOL_VERSION,'/').'-/',$release)) |
|
115 | + if (!preg_match('/'.preg_quote(DOL_VERSION, '/').'-/', $release)) |
|
116 | 116 | { |
117 | 117 | print 'Error: When parameter "includecustom" is set, version declared into filefunc.inc.php ('.DOL_VERSION.') must be used with a suffix into "release" parameter (ex: '.DOL_VERSION.'-mydistrib).'."\n"; |
118 | 118 | print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n"; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | print "Include constants in signature : "; |
126 | 126 | foreach ($includeconstants as $countrycode => $tmp) |
127 | 127 | { |
128 | - foreach($tmp as $constname => $constvalue) |
|
128 | + foreach ($tmp as $constname => $constvalue) |
|
129 | 129 | { |
130 | 130 | print $constname.'='.$constvalue." "; |
131 | 131 | } |
@@ -133,24 +133,24 @@ discard block |
||
133 | 133 | print "\n"; |
134 | 134 | |
135 | 135 | //$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml'; |
136 | -$outputdir=dirname(dirname(__FILE__)).'/htdocs/install'; |
|
136 | +$outputdir = dirname(dirname(__FILE__)).'/htdocs/install'; |
|
137 | 137 | print 'Delete current files '.$outputdir.'/filelist*.xml'."\n"; |
138 | -dol_delete_file($outputdir.'/filelist*.xml',0,1,1); |
|
138 | +dol_delete_file($outputdir.'/filelist*.xml', 0, 1, 1); |
|
139 | 139 | |
140 | -$checksumconcat=array(); |
|
140 | +$checksumconcat = array(); |
|
141 | 141 | |
142 | -$outputfile=$outputdir.'/filelist-'.$release.'.xml'; |
|
143 | -$fp = fopen($outputfile,'w'); |
|
142 | +$outputfile = $outputdir.'/filelist-'.$release.'.xml'; |
|
143 | +$fp = fopen($outputfile, 'w'); |
|
144 | 144 | fputs($fp, '<?xml version="1.0" encoding="UTF-8" ?>'."\n"); |
145 | 145 | fputs($fp, '<checksum_list version="'.$release.'" date="'.dol_print_date(dol_now(), 'dayhourrfc').'" generator="'.$script_file.'">'."\n"); |
146 | 146 | |
147 | 147 | foreach ($includeconstants as $countrycode => $tmp) |
148 | 148 | { |
149 | 149 | fputs($fp, '<dolibarr_constants country="'.$countrycode.'">'."\n"); |
150 | - foreach($tmp as $constname => $constvalue) |
|
150 | + foreach ($tmp as $constname => $constvalue) |
|
151 | 151 | { |
152 | - $valueforchecksum=(empty($constvalue)?'0':$constvalue); |
|
153 | - $checksumconcat[]=$valueforchecksum; |
|
152 | + $valueforchecksum = (empty($constvalue) ? '0' : $constvalue); |
|
153 | + $checksumconcat[] = $valueforchecksum; |
|
154 | 154 | fputs($fp, ' <constant name="'.$constname.'">'.$valueforchecksum.'</constant>'."\n"); |
155 | 155 | } |
156 | 156 | fputs($fp, '</dolibarr_constants>'."\n"); |
@@ -163,25 +163,25 @@ discard block |
||
163 | 163 | // Need to ignore document custom etc. Note: this also ignore natively symbolic links. |
164 | 164 | $files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom?'':'custom\/|').'documents\/|conf\/|install\/))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i'); |
165 | 165 | */ |
166 | -$regextoinclude='\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$'; |
|
167 | -$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs |
|
166 | +$regextoinclude = '\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$'; |
|
167 | +$regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|conf|install|public\/test|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs |
|
168 | 168 | $files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname'); |
169 | -$dir=''; |
|
170 | -$needtoclose=0; |
|
169 | +$dir = ''; |
|
170 | +$needtoclose = 0; |
|
171 | 171 | foreach ($files as $filetmp) { |
172 | 172 | $file = $filetmp['fullname']; |
173 | 173 | //$newdir = str_replace(dirname(__FILE__).'/../htdocs', '', dirname($file)); |
174 | 174 | $newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file)); |
175 | - if ($newdir!=$dir) { |
|
175 | + if ($newdir != $dir) { |
|
176 | 176 | if ($needtoclose) |
177 | 177 | fputs($fp, ' </dir>'."\n"); |
178 | 178 | fputs($fp, ' <dir name="'.$newdir.'" >'."\n"); |
179 | 179 | $dir = $newdir; |
180 | - $needtoclose=1; |
|
180 | + $needtoclose = 1; |
|
181 | 181 | } |
182 | - if (filetype($file)=="file") { |
|
183 | - $md5=md5_file($file); |
|
184 | - $checksumconcat[]=$md5; |
|
182 | + if (filetype($file) == "file") { |
|
183 | + $md5 = md5_file($file); |
|
184 | + $checksumconcat[] = $md5; |
|
185 | 185 | fputs($fp, ' <md5file name="'.basename($file).'">'.$md5.'</md5file>'."\n"); |
186 | 186 | } |
187 | 187 | } |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | asort($checksumconcat); // Sort list of checksum |
192 | 192 | //var_dump($checksumconcat); |
193 | 193 | fputs($fp, '<dolibarr_htdocs_dir_checksum>'."\n"); |
194 | -fputs($fp, md5(join(',',$checksumconcat))."\n"); |
|
194 | +fputs($fp, md5(join(',', $checksumconcat))."\n"); |
|
195 | 195 | fputs($fp, '</dolibarr_htdocs_dir_checksum>'."\n"); |
196 | 196 | |
197 | 197 | |
198 | -$checksumconcat=array(); |
|
198 | +$checksumconcat = array(); |
|
199 | 199 | |
200 | 200 | fputs($fp, '<dolibarr_script_dir version="'.$release.'">'."\n"); |
201 | 201 | |
@@ -205,26 +205,26 @@ discard block |
||
205 | 205 | // Need to ignore document custom etc. Note: this also ignore natively symbolic links. |
206 | 206 | $files = new RegexIterator($iterator2, '#^(?:[A-Z]:)?(?:/(?!(?:custom|documents|conf|install))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i'); |
207 | 207 | */ |
208 | -$regextoinclude='\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$'; |
|
209 | -$regextoexclude='(custom|documents|conf|install)$'; // Exclude dirs |
|
208 | +$regextoinclude = '\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$'; |
|
209 | +$regextoexclude = '(custom|documents|conf|install)$'; // Exclude dirs |
|
210 | 210 | $files = dol_dir_list(dirname(__FILE__).'/../scripts/', 'files', 1, $regextoinclude, $regextoexclude, 'fullname'); |
211 | -$dir=''; |
|
212 | -$needtoclose=0; |
|
211 | +$dir = ''; |
|
212 | +$needtoclose = 0; |
|
213 | 213 | foreach ($files as $filetmp) { |
214 | 214 | $file = $filetmp['fullname']; |
215 | 215 | //$newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file)); |
216 | 216 | $newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file)); |
217 | 217 | $newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file)); |
218 | - if ($newdir!=$dir) { |
|
218 | + if ($newdir != $dir) { |
|
219 | 219 | if ($needtoclose) |
220 | 220 | fputs($fp, ' </dir>'."\n"); |
221 | 221 | fputs($fp, ' <dir name="'.$newdir.'" >'."\n"); |
222 | 222 | $dir = $newdir; |
223 | - $needtoclose=1; |
|
223 | + $needtoclose = 1; |
|
224 | 224 | } |
225 | - if (filetype($file)=="file") { |
|
226 | - $md5=md5_file($file); |
|
227 | - $checksumconcat[]=$md5; |
|
225 | + if (filetype($file) == "file") { |
|
226 | + $md5 = md5_file($file); |
|
227 | + $checksumconcat[] = $md5; |
|
228 | 228 | fputs($fp, ' <md5file name="'.basename($file).'">'.$md5.'</md5file>'."\n"); |
229 | 229 | } |
230 | 230 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | asort($checksumconcat); // Sort list of checksum |
235 | 235 | fputs($fp, '<dolibarr_script_dir_checksum>'."\n"); |
236 | -fputs($fp, md5(join(',',$checksumconcat))."\n"); |
|
236 | +fputs($fp, md5(join(',', $checksumconcat))."\n"); |
|
237 | 237 | fputs($fp, '</dolibarr_script_dir_checksum>'."\n"); |
238 | 238 | |
239 | 239 | fputs($fp, '</checksum_list>'."\n"); |
@@ -64,11 +64,11 @@ |
||
64 | 64 | - To convert pfx certificate to pem: openssl pkcs12 -in tcpdf.pfx -out tcpdf.crt -nodes |
65 | 65 | |
66 | 66 | */ |
67 | -$permissions=array('copy'); |
|
68 | -$user_pass='aaa'; |
|
69 | -$owner_pass=null; |
|
70 | -$mode=0; |
|
71 | -$pubkeys=null; |
|
67 | +$permissions = array('copy'); |
|
68 | +$user_pass = 'aaa'; |
|
69 | +$owner_pass = null; |
|
70 | +$mode = 0; |
|
71 | +$pubkeys = null; |
|
72 | 72 | $pdf->SetProtection($permissions, $user_pass, $owner_pass, $mode, $pubkeys); |
73 | 73 | |
74 | 74 | // Example with public-key |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | $sapi_type = php_sapi_name(); |
27 | 27 | $script_file = basename(__FILE__); |
28 | -$path=dirname(__FILE__).'/'; |
|
28 | +$path = dirname(__FILE__).'/'; |
|
29 | 29 | |
30 | 30 | // Test if batch mode |
31 | 31 | if (substr($sapi_type, 0, 3) == 'cgi') { |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | // Global variables |
37 | -$version='1.7'; |
|
38 | -$error=0; |
|
37 | +$version = '1.7'; |
|
38 | +$error = 0; |
|
39 | 39 | |
40 | 40 | |
41 | 41 | // -------------------- START OF YOUR CODE HERE -------------------- |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | // After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file. |
45 | 45 | |
46 | 46 | //$langs->setDefaultLang('en_US'); // To change default language of $langs |
47 | -$langs->load("main"); // To load language file for default language |
|
47 | +$langs->load("main"); // To load language file for default language |
|
48 | 48 | @set_time_limit(0); |
49 | 49 | |
50 | 50 | // Load user and its permissions |
51 | -$result=$user->fetch('','admin'); // Load user for login 'admin'. Comment line to run as anonymous user. |
|
52 | -if (! $result > 0) { dol_print_error('',$user->error); exit; } |
|
51 | +$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. |
|
52 | +if (!$result > 0) { dol_print_error('', $user->error); exit; } |
|
53 | 53 | $user->getrights(); |
54 | 54 | |
55 | 55 | |
@@ -65,43 +65,43 @@ discard block |
||
65 | 65 | //$obj->initAsSpecimen(); |
66 | 66 | |
67 | 67 | $obj->ref = 'ABCDE'; |
68 | -$obj->socid = 4; // Put id of third party (rowid in llx_societe table) |
|
68 | +$obj->socid = 4; // Put id of third party (rowid in llx_societe table) |
|
69 | 69 | $obj->date = mktime(); |
70 | 70 | $obj->note = 'A comment'; |
71 | 71 | $obj->cond_reglement_id = 1; |
72 | 72 | |
73 | -$line1=new FactureLigne($db); |
|
74 | -$line1->tva_tx=10.0; |
|
75 | -$line1->remise_percent=0; |
|
76 | -$line1->qty=1; |
|
77 | -$line1->total_ht=100; |
|
78 | -$line1->total_tva=10; |
|
79 | -$line1->total_ttc=110; |
|
80 | -$obj->lines[]=$line1; |
|
73 | +$line1 = new FactureLigne($db); |
|
74 | +$line1->tva_tx = 10.0; |
|
75 | +$line1->remise_percent = 0; |
|
76 | +$line1->qty = 1; |
|
77 | +$line1->total_ht = 100; |
|
78 | +$line1->total_tva = 10; |
|
79 | +$line1->total_ttc = 110; |
|
80 | +$obj->lines[] = $line1; |
|
81 | 81 | |
82 | 82 | // Create invoice |
83 | -$idobject=$obj->create($user); |
|
83 | +$idobject = $obj->create($user); |
|
84 | 84 | if ($idobject > 0) |
85 | 85 | { |
86 | 86 | // Change status to validated |
87 | - $result=$obj->validate($user); |
|
87 | + $result = $obj->validate($user); |
|
88 | 88 | if ($result > 0) print "OK Object created with id ".$idobject."\n"; |
89 | 89 | else |
90 | 90 | { |
91 | 91 | $error++; |
92 | - dol_print_error($db,$obj->error); |
|
92 | + dol_print_error($db, $obj->error); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | else |
96 | 96 | { |
97 | 97 | $error++; |
98 | - dol_print_error($db,$obj->error); |
|
98 | + dol_print_error($db, $obj->error); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
102 | 102 | // -------------------- END OF YOUR CODE -------------------- |
103 | 103 | |
104 | -if (! $error) |
|
104 | +if (!$error) |
|
105 | 105 | { |
106 | 106 | $db->commit(); |
107 | 107 | print '--- end ok'."\n"; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | $sapi_type = php_sapi_name(); |
27 | 27 | $script_file = basename(__FILE__); |
28 | -$path=dirname(__FILE__).'/'; |
|
28 | +$path = dirname(__FILE__).'/'; |
|
29 | 29 | |
30 | 30 | // Test if batch mode |
31 | 31 | if (substr($sapi_type, 0, 3) == 'cgi') { |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | // Global variables |
37 | -$version='1.7'; |
|
38 | -$error=0; |
|
37 | +$version = '1.7'; |
|
38 | +$error = 0; |
|
39 | 39 | |
40 | 40 | |
41 | 41 | // -------------------- START OF YOUR CODE HERE -------------------- |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | // After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file. |
45 | 45 | |
46 | 46 | //$langs->setDefaultLang('en_US'); // To change default language of $langs |
47 | -$langs->load("main"); // To load language file for default language |
|
47 | +$langs->load("main"); // To load language file for default language |
|
48 | 48 | @set_time_limit(0); |
49 | 49 | |
50 | 50 | // Load user and its permissions |
51 | -$result=$user->fetch('','admin'); // Load user for login 'admin'. Comment line to run as anonymous user. |
|
52 | -if (! $result > 0) { dol_print_error('',$user->error); exit; } |
|
51 | +$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. |
|
52 | +if (!$result > 0) { dol_print_error('', $user->error); exit; } |
|
53 | 53 | $user->getrights(); |
54 | 54 | |
55 | 55 | |
56 | 56 | print "***** ".$script_file." (".$version.") *****\n"; |
57 | -if (! isset($argv[1])) { // Check parameters |
|
57 | +if (!isset($argv[1])) { // Check parameters |
|
58 | 58 | print "Usage: ".$script_file." id_thirdparty ...\n"; |
59 | 59 | exit; |
60 | 60 | } |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | |
70 | 70 | // Create contract object |
71 | 71 | $obj = new Contrat($db); |
72 | -$obj->socid=$argv[1]; |
|
72 | +$obj->socid = $argv[1]; |
|
73 | 73 | |
74 | -$listofcontractsforcompany=$obj->getListOfContracts('all'); |
|
74 | +$listofcontractsforcompany = $obj->getListOfContracts('all'); |
|
75 | 75 | |
76 | 76 | print $listofcontractsforcompany; |
77 | 77 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | $sapi_type = php_sapi_name(); |
27 | 27 | $script_file = basename(__FILE__); |
28 | -$path=dirname(__FILE__).'/'; |
|
28 | +$path = dirname(__FILE__).'/'; |
|
29 | 29 | |
30 | 30 | // Test if batch mode |
31 | 31 | if (substr($sapi_type, 0, 3) == 'cgi') { |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | // Global variables |
37 | -$version='1.7'; |
|
38 | -$error=0; |
|
37 | +$version = '1.7'; |
|
38 | +$error = 0; |
|
39 | 39 | |
40 | 40 | |
41 | 41 | // -------------------- START OF YOUR CODE HERE -------------------- |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | // After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file. |
45 | 45 | |
46 | 46 | //$langs->setDefaultLang('en_US'); // To change default language of $langs |
47 | -$langs->load("main"); // To load language file for default language |
|
47 | +$langs->load("main"); // To load language file for default language |
|
48 | 48 | @set_time_limit(0); |
49 | 49 | |
50 | 50 | // Load user and its permissions |
51 | -$result=$user->fetch('','admin'); // Load user for login 'admin'. Comment line to run as anonymous user. |
|
52 | -if (! $result > 0) { dol_print_error('',$user->error); exit; } |
|
51 | +$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. |
|
52 | +if (!$result > 0) { dol_print_error('', $user->error); exit; } |
|
53 | 53 | $user->getrights(); |
54 | 54 | |
55 | 55 | |
@@ -68,16 +68,16 @@ discard block |
||
68 | 68 | $obj->nom = 'ABCDEF'; |
69 | 69 | |
70 | 70 | // Create user |
71 | -$idobject=$obj->create($user); |
|
71 | +$idobject = $obj->create($user); |
|
72 | 72 | if ($idobject > 0) |
73 | 73 | { |
74 | 74 | // Change status to validated |
75 | - $result=$obj->setStatut(1); |
|
75 | + $result = $obj->setStatut(1); |
|
76 | 76 | if ($result > 0) print "OK Object created with id ".$idobject."\n"; |
77 | 77 | else |
78 | 78 | { |
79 | 79 | $error++; |
80 | - dol_print_error($db,$obj->error); |
|
80 | + dol_print_error($db, $obj->error); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | else if ($obj->error == 'ErrorLoginAlreadyExists') |
@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | else |
88 | 88 | { |
89 | 89 | $error++; |
90 | - dol_print_error($db,$obj->error); |
|
90 | + dol_print_error($db, $obj->error); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
94 | 94 | // -------------------- END OF YOUR CODE -------------------- |
95 | 95 | |
96 | -if (! $error) |
|
96 | +if (!$error) |
|
97 | 97 | { |
98 | 98 | $db->commit(); |
99 | 99 | print '--- end ok'."\n"; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | $sapi_type = php_sapi_name(); |
27 | 27 | $script_file = basename(__FILE__); |
28 | -$path=dirname(__FILE__).'/'; |
|
28 | +$path = dirname(__FILE__).'/'; |
|
29 | 29 | |
30 | 30 | // Test if batch mode |
31 | 31 | if (substr($sapi_type, 0, 3) == 'cgi') { |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | // Global variables |
37 | -$version='1.11'; |
|
38 | -$error=0; |
|
37 | +$version = '1.11'; |
|
38 | +$error = 0; |
|
39 | 39 | |
40 | 40 | |
41 | 41 | // -------------------- START OF YOUR CODE HERE -------------------- |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | // After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file. |
45 | 45 | |
46 | 46 | //$langs->setDefaultLang('en_US'); // To change default language of $langs |
47 | -$langs->load("main"); // To load language file for default language |
|
47 | +$langs->load("main"); // To load language file for default language |
|
48 | 48 | @set_time_limit(0); |
49 | 49 | |
50 | 50 | // Load user and its permissions |
51 | -$result=$user->fetch('','admin'); // Load user for login 'admin'. Comment line to run as anonymous user. |
|
52 | -if (! $result > 0) { dol_print_error('',$user->error); exit; } |
|
51 | +$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. |
|
52 | +if (!$result > 0) { dol_print_error('', $user->error); exit; } |
|
53 | 53 | $user->getrights(); |
54 | 54 | |
55 | 55 | |
@@ -65,41 +65,41 @@ discard block |
||
65 | 65 | $com = new Commande($db); |
66 | 66 | |
67 | 67 | $com->ref = 'ABCDE'; |
68 | -$com->socid = 4; // Put id of third party (rowid in llx_societe table) |
|
68 | +$com->socid = 4; // Put id of third party (rowid in llx_societe table) |
|
69 | 69 | $com->date_commande = mktime(); |
70 | 70 | $com->note = 'A comment'; |
71 | 71 | $com->source = 1; |
72 | 72 | $com->remise_percent = 0; |
73 | 73 | |
74 | -$orderline1=new OrderLine($db); |
|
75 | -$orderline1->tva_tx=10.0; |
|
76 | -$orderline1->remise_percent=0; |
|
77 | -$orderline1->qty=1; |
|
78 | -$com->lines[]=$orderline1; |
|
74 | +$orderline1 = new OrderLine($db); |
|
75 | +$orderline1->tva_tx = 10.0; |
|
76 | +$orderline1->remise_percent = 0; |
|
77 | +$orderline1->qty = 1; |
|
78 | +$com->lines[] = $orderline1; |
|
79 | 79 | |
80 | 80 | // Create order |
81 | -$idobject=$com->create($user); |
|
81 | +$idobject = $com->create($user); |
|
82 | 82 | if ($idobject > 0) |
83 | 83 | { |
84 | 84 | // Change status to validated |
85 | - $result=$com->valid($user); |
|
85 | + $result = $com->valid($user); |
|
86 | 86 | if ($result > 0) print "OK Object created with id ".$idobject."\n"; |
87 | 87 | else |
88 | 88 | { |
89 | 89 | $error++; |
90 | - dol_print_error($db,$com->error); |
|
90 | + dol_print_error($db, $com->error); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | else |
94 | 94 | { |
95 | 95 | $error++; |
96 | - dol_print_error($db,$com->error); |
|
96 | + dol_print_error($db, $com->error); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
100 | 100 | // -------------------- END OF YOUR CODE -------------------- |
101 | 101 | |
102 | -if (! $error) |
|
102 | +if (!$error) |
|
103 | 103 | { |
104 | 104 | $db->commit(); |
105 | 105 | print '--- end ok'."\n"; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | $sapi_type = php_sapi_name(); |
27 | 27 | $script_file = basename(__FILE__); |
28 | -$path=dirname(__FILE__).'/'; |
|
28 | +$path = dirname(__FILE__).'/'; |
|
29 | 29 | |
30 | 30 | // Test if batch mode |
31 | 31 | if (substr($sapi_type, 0, 3) == 'cgi') { |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | // Global variables |
37 | -$version='1.10'; |
|
38 | -$error=0; |
|
37 | +$version = '1.10'; |
|
38 | +$error = 0; |
|
39 | 39 | |
40 | 40 | |
41 | 41 | // -------------------- START OF YOUR CODE HERE -------------------- |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | // After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file. |
45 | 45 | |
46 | 46 | //$langs->setDefaultLang('en_US'); // To change default language of $langs |
47 | -$langs->load("main"); // To load language file for default language |
|
47 | +$langs->load("main"); // To load language file for default language |
|
48 | 48 | @set_time_limit(0); |
49 | 49 | |
50 | 50 | // Load user and its permissions |
51 | -$result=$user->fetch('','admin'); // Load user for login 'admin'. Comment line to run as anonymous user. |
|
52 | -if (! $result > 0) { dol_print_error('',$user->error); exit; } |
|
51 | +$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. |
|
52 | +if (!$result > 0) { dol_print_error('', $user->error); exit; } |
|
53 | 53 | $user->getrights(); |
54 | 54 | |
55 | 55 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; |
63 | 63 | |
64 | 64 | // Create instance of object |
65 | -$myproduct=new Product($db); |
|
65 | +$myproduct = new Product($db); |
|
66 | 66 | |
67 | 67 | // Definition of product instance properties |
68 | 68 | $myproduct->ref = '1234'; |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | else |
87 | 87 | { |
88 | 88 | $error++; |
89 | - dol_print_error($db,$myproduct->error); |
|
89 | + dol_print_error($db, $myproduct->error); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | // -------------------- END OF YOUR CODE -------------------- |
93 | 93 | |
94 | -if (! $error) |
|
94 | +if (!$error) |
|
95 | 95 | { |
96 | 96 | $db->commit(); |
97 | 97 | print '--- end ok'."\n"; |
@@ -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 http://www.google.com/language_tools\n"; |
@@ -66,21 +66,21 @@ 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 | 71 | { |
72 | - $file=$argv[4]; |
|
72 | + $file = $argv[4]; |
|
73 | 73 | print 'Argument 4='.$argv[4]."\n"; |
74 | 74 | } |
75 | 75 | print 'Files will be generated/updated in directory '.$dir."\n"; |
76 | 76 | |
77 | 77 | if ($argv[2] != 'all') |
78 | 78 | { |
79 | - if (! is_dir($dir.'/'.$argv[2])) |
|
79 | + if (!is_dir($dir.'/'.$argv[2])) |
|
80 | 80 | { |
81 | 81 | print 'Create directory '.$dir.'/'.$argv[2]."\n"; |
82 | - $result=mkdir($dir.'/'.$argv[2]); |
|
83 | - if (! $result) |
|
82 | + $result = mkdir($dir.'/'.$argv[2]); |
|
83 | + if (!$result) |
|
84 | 84 | { |
85 | 85 | $db->close(); |
86 | 86 | return -1; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | require_once DOL_DOCUMENT_ROOT."/../dev/translation/autotranslator.class.php"; |
92 | 92 | |
93 | -$langParser = new autoTranslator($argv[2],$argv[1],$dir,$file,$argv[3]); |
|
93 | +$langParser = new autoTranslator($argv[2], $argv[1], $dir, $file, $argv[3]); |
|
94 | 94 | |
95 | 95 | print "***** Finished *****\n"; |
96 | 96 |