@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * \brief PHPUnit test for the BlockedLog and LNE class. |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | -global $conf,$user,$langs,$db; |
|
| 27 | +global $conf, $user, $langs, $db; |
|
| 28 | 28 | //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver |
| 29 | 29 | //require_once 'PHPUnit/Autoload.php'; |
| 30 | 30 | require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function testBlockedLogAndLNETest() |
| 60 | 60 | { |
| 61 | - global $conf,$user,$langs,$db; |
|
| 61 | + global $conf, $user, $langs, $db; |
|
| 62 | 62 | $conf = $this->savconf; |
| 63 | 63 | $user = $this->savuser; |
| 64 | 64 | $langs = $this->savlangs; |
@@ -25,33 +25,33 @@ discard block |
||
| 25 | 25 | * \remarks To run this script as CLI: phpunit filename.php |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | -global $conf,$user,$langs,$db; |
|
| 28 | +global $conf, $user, $langs, $db; |
|
| 29 | 29 | //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver |
| 30 | 30 | //require_once 'PHPUnit/Autoload.php'; |
| 31 | 31 | |
| 32 | -if (! defined('NOCSRFCHECK')) { |
|
| 32 | +if (!defined('NOCSRFCHECK')) { |
|
| 33 | 33 | define('NOCSRFCHECK', '1'); |
| 34 | 34 | } |
| 35 | -if (! defined('NOTOKENRENEWAL')) { |
|
| 35 | +if (!defined('NOTOKENRENEWAL')) { |
|
| 36 | 36 | define('NOTOKENRENEWAL', '1'); |
| 37 | 37 | } |
| 38 | -if (! defined('NOREQUIREMENU')) { |
|
| 38 | +if (!defined('NOREQUIREMENU')) { |
|
| 39 | 39 | define('NOREQUIREMENU', '1'); // If there is no menu to show |
| 40 | 40 | } |
| 41 | -if (! defined('NOREQUIREHTML')) { |
|
| 41 | +if (!defined('NOREQUIREHTML')) { |
|
| 42 | 42 | define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php |
| 43 | 43 | } |
| 44 | -if (! defined('NOREQUIREAJAX')) { |
|
| 44 | +if (!defined('NOREQUIREAJAX')) { |
|
| 45 | 45 | define('NOREQUIREAJAX', '1'); |
| 46 | 46 | } |
| 47 | -if (! defined("NOLOGIN")) { |
|
| 48 | - define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
| 47 | +if (!defined("NOLOGIN")) { |
|
| 48 | + define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
| 49 | 49 | } |
| 50 | -if (! defined("NOSESSION")) { |
|
| 50 | +if (!defined("NOSESSION")) { |
|
| 51 | 51 | define("NOSESSION", '1'); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -require_once dirname(__FILE__).'/../../htdocs/main.inc.php'; // We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test. |
|
| 54 | +require_once dirname(__FILE__).'/../../htdocs/main.inc.php'; // We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test. |
|
| 55 | 55 | require_once dirname(__FILE__).'/../../htdocs/core/lib/security.lib.php'; |
| 56 | 56 | require_once dirname(__FILE__).'/../../htdocs/core/lib/security2.lib.php'; |
| 57 | 57 | require_once dirname(__FILE__).'/CommonClassTest.class.php'; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function testGETPOST() |
| 82 | 82 | { |
| 83 | - global $conf,$user,$langs,$db,$mysoc; |
|
| 83 | + global $conf, $user, $langs, $db, $mysoc; |
|
| 84 | 84 | $conf = $this->savconf; |
| 85 | 85 | $user = $this->savuser; |
| 86 | 86 | $langs = $this->savlangs; |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $_GET["param1"] = "222"; |
| 98 | 98 | $_POST["param1"] = "333"; |
| 99 | 99 | $_GET["param2"] = 'a/b#e(pr)qq-rr\cc'; |
| 100 | - $_GET["param3"] = '"na/b#e(pr)qq-rr\cc'; // Same than param2 + " and n |
|
| 100 | + $_GET["param3"] = '"na/b#e(pr)qq-rr\cc'; // Same than param2 + " and n |
|
| 101 | 101 | $_GET["param4a"] = '../../dir'; |
| 102 | 102 | $_GET["param4b"] = '..\..\dirwindows'; |
| 103 | 103 | $_GET["param4c"] = '\a123 \123 \u123 \x123'; |
@@ -105,11 +105,11 @@ discard block |
||
| 105 | 105 | $_POST["param6"] = ""><svg onload='console.log("123")'>"; |
| 106 | 106 | $_POST["param6b"] = '<<<../>../>../svg><<<../>../>../animate =alert(1)>abc'; |
| 107 | 107 | $_GET["param7"] = '"c:\this is a path~1\aaan &#x110;" abc<bad>def</bad>'; |
| 108 | - $_POST["param8a"] = "Hacker<svg onload='console.log("123")'"; // html tag is not closed so it is not detected as html tag but is still harmfull |
|
| 109 | - $_POST['param8b'] = '<img src=x onerror=alert(document.location) t='; // this is html obfuscated by non closing tag |
|
| 108 | + $_POST["param8a"] = "Hacker<svg onload='console.log("123")'"; // html tag is not closed so it is not detected as html tag but is still harmfull |
|
| 109 | + $_POST['param8b'] = '<img src=x onerror=alert(document.location) t='; // this is html obfuscated by non closing tag |
|
| 110 | 110 | $_POST['param8c'] = '< with space after is ok'; |
| 111 | 111 | $_POST['param8d'] = '<abc123 is html to clean'; |
| 112 | - $_POST['param8e'] = '<123abc is not html to clean'; // other similar case: '<2021-12-12' |
|
| 112 | + $_POST['param8e'] = '<123abc is not html to clean'; // other similar case: '<2021-12-12' |
|
| 113 | 113 | $_POST['param8f'] = 'abc<<svg <><<animate onbegin=alert(document.domain) a'; |
| 114 | 114 | $_POST["param9"] = 'is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'objnotdefined\''; |
| 115 | 115 | $_POST["param10"] = 'is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'<abc>objnotdefined\''; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $_GET["param20"] = '<link rel="dns-prefetch" href="//cdnjs.cloudflare.com" />'; |
| 130 | 130 | |
| 131 | 131 | |
| 132 | - $result = GETPOST('id', 'int'); // Must return nothing |
|
| 132 | + $result = GETPOST('id', 'int'); // Must return nothing |
|
| 133 | 133 | print __METHOD__." result=".$result."\n"; |
| 134 | 134 | $this->assertEquals('', $result); |
| 135 | 135 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | // Test with alpha |
| 145 | 145 | |
| 146 | - $result = GETPOST("param0", 'alpha'); // a simple format, so " completely removed |
|
| 146 | + $result = GETPOST("param0", 'alpha'); // a simple format, so " completely removed |
|
| 147 | 147 | $resultexpected = 'A real string with aaa and and \' and & inside content'; |
| 148 | 148 | print __METHOD__." result=".$result."\n"; |
| 149 | 149 | $this->assertEquals($resultexpected, $result, 'Test on param0'); |
@@ -152,19 +152,19 @@ discard block |
||
| 152 | 152 | print __METHOD__." result=".$result."\n"; |
| 153 | 153 | $this->assertEquals('a/b#e(pr)qq-rr\cc', $result, 'Test on param2'); |
| 154 | 154 | |
| 155 | - $result = GETPOST("param3", 'alpha'); // Must return string sanitized from char " |
|
| 155 | + $result = GETPOST("param3", 'alpha'); // Must return string sanitized from char " |
|
| 156 | 156 | print __METHOD__." result=".$result."\n"; |
| 157 | 157 | $this->assertEquals('na/b#e(pr)qq-rr\cc', $result, 'Test on param3'); |
| 158 | 158 | |
| 159 | - $result = GETPOST("param4a", 'alpha'); // Must return string sanitized from ../ |
|
| 159 | + $result = GETPOST("param4a", 'alpha'); // Must return string sanitized from ../ |
|
| 160 | 160 | print __METHOD__." result=".$result."\n"; |
| 161 | 161 | $this->assertEquals('dir', $result); |
| 162 | 162 | |
| 163 | - $result = GETPOST("param4b", 'alpha'); // Must return string sanitized from ../ |
|
| 163 | + $result = GETPOST("param4b", 'alpha'); // Must return string sanitized from ../ |
|
| 164 | 164 | print __METHOD__." result=".$result."\n"; |
| 165 | 165 | $this->assertEquals('dirwindows', $result); |
| 166 | 166 | |
| 167 | - $result = GETPOST("param4c", 'alpha'); // Must return string sanitized from ../ |
|
| 167 | + $result = GETPOST("param4c", 'alpha'); // Must return string sanitized from ../ |
|
| 168 | 168 | print __METHOD__." result=".$result."\n"; |
| 169 | 169 | $this->assertEquals('\a123 /123 /u123 /x123', $result); |
| 170 | 170 | |
@@ -174,19 +174,19 @@ discard block |
||
| 174 | 174 | print __METHOD__." result=".$result."\n"; |
| 175 | 175 | $this->assertEquals($result, $_GET["param1"]); |
| 176 | 176 | |
| 177 | - $result = GETPOST("param2", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 177 | + $result = GETPOST("param2", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 178 | 178 | print __METHOD__." result=".$result."\n"; |
| 179 | 179 | $this->assertEquals($result, ''); |
| 180 | 180 | |
| 181 | - $result = GETPOST("param3", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 181 | + $result = GETPOST("param3", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 182 | 182 | print __METHOD__." result=".$result."\n"; |
| 183 | 183 | $this->assertEquals($result, ''); |
| 184 | 184 | |
| 185 | - $result = GETPOST("param4a", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 185 | + $result = GETPOST("param4a", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 186 | 186 | print __METHOD__." result=".$result."\n"; |
| 187 | 187 | $this->assertEquals('', $result); |
| 188 | 188 | |
| 189 | - $result = GETPOST("param4b", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 189 | + $result = GETPOST("param4b", 'aZ09'); // Must return '' as string contains car not in aZ09 definition |
|
| 190 | 190 | print __METHOD__." result=".$result."\n"; |
| 191 | 191 | $this->assertEquals('', $result); |
| 192 | 192 | |
@@ -297,13 +297,13 @@ discard block |
||
| 297 | 297 | print __METHOD__." result=".$result."\n"; |
| 298 | 298 | $this->assertEquals("Text with ' encoded with the numeric html entity converted into text entity ' (like when submitted by CKEditor)", $result, 'Test 14'); |
| 299 | 299 | |
| 300 | - $result = GETPOST("param15", 'restricthtml'); // param15 = <img onxxxx<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 300 | + $result = GETPOST("param15", 'restricthtml'); // param15 = <img onxxxx<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 301 | 301 | print __METHOD__." result=".$result."\n"; |
| 302 | - $this->assertEquals("<img onxxxx=alert(document.domain) src=>0xbeefed", $result, 'Test 15'); // The GETPOST return a harmull string |
|
| 302 | + $this->assertEquals("<img onxxxx=alert(document.domain) src=>0xbeefed", $result, 'Test 15'); // The GETPOST return a harmull string |
|
| 303 | 303 | |
| 304 | - $result = GETPOST("param15b", 'restricthtml'); // param15b = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 304 | + $result = GETPOST("param15b", 'restricthtml'); // param15b = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 305 | 305 | print __METHOD__." result=".$result."\n"; |
| 306 | - $this->assertEquals("<img alert(document.domain) src=>0xbeefed", $result, 'Test 15b'); // The GETPOST return a harmull string |
|
| 306 | + $this->assertEquals("<img alert(document.domain) src=>0xbeefed", $result, 'Test 15b'); // The GETPOST return a harmull string |
|
| 307 | 307 | |
| 308 | 308 | $result = GETPOST("param19", 'restricthtml'); |
| 309 | 309 | print __METHOD__." result=".$result."\n"; |
@@ -322,17 +322,17 @@ discard block |
||
| 322 | 322 | print __METHOD__." result for param0=".$result."\n"; |
| 323 | 323 | $this->assertEquals($resultexpected, $result, 'Test on param0'); |
| 324 | 324 | |
| 325 | - $result = GETPOST("param15b", 'restricthtml'); // param15b = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 325 | + $result = GETPOST("param15b", 'restricthtml'); // param15b = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 326 | 326 | print __METHOD__." result for param15b=".$result."\n"; |
| 327 | 327 | //$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... |
| 328 | 328 | //$this->assertEquals('<img onerror> src=>0xbeefed', $result, 'Test 15b'); // ... on other PHP and libxml versions, we got a HTML that has been cleaned |
| 329 | 329 | |
| 330 | - $result = GETPOST("param6", 'restricthtml'); // param6 = ""><svg onload='console.log("123")'>" |
|
| 330 | + $result = GETPOST("param6", 'restricthtml'); // param6 = ""><svg onload='console.log("123")'>" |
|
| 331 | 331 | print __METHOD__." result for param6=".$result." - before=".$_POST["param6"]."\n"; |
| 332 | 332 | //$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... |
| 333 | 333 | //$this->assertEquals('">', $result); // ... on other PHP and libxml versions, we got a HTML that has been cleaned |
| 334 | 334 | |
| 335 | - $result = GETPOST("param7", 'restricthtml'); // param7 = "c:\this is a path~1\aaan &#x110;" abc<bad>def</bad> |
|
| 335 | + $result = GETPOST("param7", 'restricthtml'); // param7 = "c:\this is a path~1\aaan &#x110;" abc<bad>def</bad> |
|
| 336 | 336 | print __METHOD__." result param7 = ".$result."\n"; |
| 337 | 337 | //$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... |
| 338 | 338 | //$this->assertEquals('"c:\this is a path~1\aaan 110;" abcdef', $result); // ... on other PHP and libxml versions, we got a HTML that has been cleaned |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | print __METHOD__." result for param0=".$result."\n"; |
| 355 | 355 | $this->assertEquals($resultexpected, $result, 'Test on param0'); |
| 356 | 356 | |
| 357 | - $result = GETPOST("param15b", 'restricthtml'); // param15b = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 357 | + $result = GETPOST("param15b", 'restricthtml'); // param15b = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 358 | 358 | print __METHOD__." result for param15b=".$result."\n"; |
| 359 | 359 | //$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... |
| 360 | 360 | //$this->assertEquals('<img onerror> src=>0xbeefed', $result, 'Test 15b'); // ... on other PHP and libxml versions, we got a HTML that has been cleaned |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | print __METHOD__." result for param0=".$result."\n"; |
| 383 | 383 | $this->assertEquals($resultexpected, $result, 'Test on param0'); |
| 384 | 384 | |
| 385 | - $result = GETPOST("param15b", 'restricthtml'); // param15b = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 385 | + $result = GETPOST("param15b", 'restricthtml'); // param15b = <img onerror<=alert(document.domain)> src=>0xbeefed that is a dangerous string |
|
| 386 | 386 | print __METHOD__." result=".$result."\n"; |
| 387 | 387 | //$this->assertEquals('InvalidHTMLStringCantBeCleaned', $result, 'Test 15b'); // With some PHP and libxml version, we got this result when parsing invalid HTML, but ... |
| 388 | 388 | //$this->assertEquals('<img onerror> src=>0xbeefed', $result, 'Test 15b'); // ... on other PHP and libxml versions, we got a HTML that has been cleaned |
@@ -1203,7 +1203,7 @@ discard block |
||
| 1203 | 1203 | } |
| 1204 | 1204 | print '<td colspan="'.($colspan - 1).'" class="" style="padding-left: 20px; padding-right: 20px;">'; |
| 1205 | 1205 | |
| 1206 | - $fieldsforcontent = array('topic', 'email_from','joinfiles', 'content'); |
|
| 1206 | + $fieldsforcontent = array('topic', 'email_from', 'joinfiles', 'content'); |
|
| 1207 | 1207 | if (getDolGlobalString('MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES')) { |
| 1208 | 1208 | $fieldsforcontent[] = 'content_lines'; |
| 1209 | 1209 | } |
@@ -1293,7 +1293,7 @@ discard block |
||
| 1293 | 1293 | continue; // It means this is a type of template not into elementList (may be because enabled condition of this type is false because module is not enabled) |
| 1294 | 1294 | } |
| 1295 | 1295 | // Test on 'enabled' |
| 1296 | - if (! (int) dol_eval((string) $obj->enabled, 1, 1, '1')) { |
|
| 1296 | + if (!(int) dol_eval((string) $obj->enabled, 1, 1, '1')) { |
|
| 1297 | 1297 | $i++; |
| 1298 | 1298 | continue; // Email template not qualified |
| 1299 | 1299 | } |
@@ -1603,7 +1603,7 @@ discard block |
||
| 1603 | 1603 | print $form->selectyesno($value, (isset($obj->$value) ? $obj->$value : ''), 1, false, 0, 1); |
| 1604 | 1604 | } |
| 1605 | 1605 | } else { |
| 1606 | - print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->$value) ? $obj->$value : '').'" name="'. $value .'"'.($context == 'preview' ? ' disabled' : '').' spellcheck="false">'; |
|
| 1606 | + print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->$value) ? $obj->$value : '').'" name="'.$value.'"'.($context == 'preview' ? ' disabled' : '').' spellcheck="false">'; |
|
| 1607 | 1607 | } |
| 1608 | 1608 | print '</td>'; |
| 1609 | 1609 | $nboffieldsprinted++; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | if ((!is_string($objecttype) || empty($objecttype)) && isModEnabled('societe')) { |
| 135 | 135 | $objecttype = 'thirdparty'; |
| 136 | 136 | } |
| 137 | -'@phan-var-force string $objecttype'; // Help phan that suggests $objecttype can be null |
|
| 137 | +'@phan-var-force string $objecttype'; // Help phan that suggests $objecttype can be null |
|
| 138 | 138 | |
| 139 | 139 | require_once DOL_DOCUMENT_ROOT."/core/class/extrafields.class.php"; |
| 140 | 140 | require_once DOL_DOCUMENT_ROOT."/core/class/html.form.class.php"; |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | // Fetch optionals attributes and labels |
| 244 | -$extrafields->fetch_name_optionals_label('all'); // We load all extrafields definitions for all objects |
|
| 244 | +$extrafields->fetch_name_optionals_label('all'); // We load all extrafields definitions for all objects |
|
| 245 | 245 | //$extrafields->fetch_name_optionals_label($object->table_element_line); |
| 246 | 246 | |
| 247 | 247 | if (!empty($object->table_element)) { |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | // If string is not an universal filter string, we try to convert it into universal filter syntax string |
| 260 | 260 | $errorstr = ''; |
| 261 | -forgeSQLFromUniversalSearchCriteria($search_component_params_input, $errorstr); // Try conversion UFS->SQL |
|
| 261 | +forgeSQLFromUniversalSearchCriteria($search_component_params_input, $errorstr); // Try conversion UFS->SQL |
|
| 262 | 262 | //var_dump($errorstr); |
| 263 | 263 | if ($errorstr) { |
| 264 | 264 | $value = $search_component_params_input; |
@@ -270,14 +270,14 @@ discard block |
||
| 270 | 270 | $crits = explode(' ', trim($value)); // the string after the name of the field. Explode on each AND |
| 271 | 271 | $res = ''; |
| 272 | 272 | |
| 273 | - $i1 = 0; // count the nb of and criteria added (all fields / criteria) |
|
| 273 | + $i1 = 0; // count the nb of and criteria added (all fields / criteria) |
|
| 274 | 274 | foreach ($crits as $crit) { // Loop on each AND criteria |
| 275 | 275 | $crit = trim($crit); |
| 276 | 276 | |
| 277 | - $i2 = 0; // count the nb of valid criteria added for this first criteria |
|
| 277 | + $i2 = 0; // count the nb of valid criteria added for this first criteria |
|
| 278 | 278 | $newres = ''; |
| 279 | 279 | $tmpcrits = explode('|', $crit); |
| 280 | - $i3 = 0; // count the nb of valid criteria added for this current field |
|
| 280 | + $i3 = 0; // count the nb of valid criteria added for this current field |
|
| 281 | 281 | foreach ($tmpcrits as $tmpcrit) { |
| 282 | 282 | if ($tmpcrit !== '0' && empty($tmpcrit)) { |
| 283 | 283 | continue; |
@@ -295,8 +295,8 @@ discard block |
||
| 295 | 295 | } |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | - $field = preg_replace('/(:[!<>=\s]+:|:in:|:notin:|:like:|:notlike:).*$/', '', $tmpcrit); // the name of the field |
|
| 299 | - $tmpcrit = preg_replace('/^.*(:[!<>=\s]+:|:in:|:notin:|:like:|:notlike:)/', '\1', $tmpcrit); // the condition after the name of the field |
|
| 298 | + $field = preg_replace('/(:[!<>=\s]+:|:in:|:notin:|:like:|:notlike:).*$/', '', $tmpcrit); // the name of the field |
|
| 299 | + $tmpcrit = preg_replace('/^.*(:[!<>=\s]+:|:in:|:notin:|:like:|:notlike:)/', '\1', $tmpcrit); // the condition after the name of the field |
|
| 300 | 300 | //var_dump($field); var_dump($tmpcrit); var_dump($i3); |
| 301 | 301 | |
| 302 | 302 | $newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : ''); |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | foreach ($arrayofmesures as $key => $val) { |
| 687 | 687 | $simplearrayofmesures[$key] = $arrayofmesures[$key]['label']; |
| 688 | 688 | } |
| 689 | - print $form->multiselectarray('search_measures', $simplearrayofmesures, $search_measures, 0, 0, 'minwidth300 widthcentpercentminusx', 1, 0, '', '', $langs->transnoentitiesnoconv("Measures")); // Fill the array $arrayofmeasures with possible fields |
|
| 689 | + print $form->multiselectarray('search_measures', $simplearrayofmesures, $search_measures, 0, 0, 'minwidth300 widthcentpercentminusx', 1, 0, '', '', $langs->transnoentitiesnoconv("Measures")); // Fill the array $arrayofmeasures with possible fields |
|
| 690 | 690 | print '</div>'; |
| 691 | 691 | |
| 692 | 692 | // XAxis |
@@ -694,14 +694,14 @@ discard block |
||
| 694 | 694 | print '<div class="divadvancedsearchfield">'; |
| 695 | 695 | print '<div class="inline-block"><span class="fas fa-ruler-combined paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("XAxis")).'"></span><span class="fas fa-caret-down caretdownaxis" title="'.dol_escape_htmltag($langs->trans("XAxis")).'"></span></div>'; |
| 696 | 696 | //var_dump($arrayofxaxis); |
| 697 | - print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis, $langs->trans("XAxis"), 'minwidth300 maxwidth400 widthcentpercentminusx'); // Fill the array $arrayofxaxis with possible fields |
|
| 697 | + print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis, $langs->trans("XAxis"), 'minwidth300 maxwidth400 widthcentpercentminusx'); // Fill the array $arrayofxaxis with possible fields |
|
| 698 | 698 | print '</div>'; |
| 699 | 699 | |
| 700 | 700 | // Group by |
| 701 | 701 | $count = 0; |
| 702 | 702 | print '<div class="divadvancedsearchfield">'; |
| 703 | 703 | print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("GroupBy")).'"></span></div>'; |
| 704 | - print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth250 maxwidth300 widthcentpercentminusx', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields |
|
| 704 | + print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth250 maxwidth300 widthcentpercentminusx', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields |
|
| 705 | 705 | print '</div>'; |
| 706 | 706 | } |
| 707 | 707 | |
@@ -862,7 +862,7 @@ discard block |
||
| 862 | 862 | //var_dump($arrayofgroupby); |
| 863 | 863 | $tmpforloop = dolExplodeIntoArray($arrayofxaxis[$val]['tablefromt'], ','); |
| 864 | 864 | foreach ($tmpforloop as $tmptable => $tmptablealias) { |
| 865 | - if (! in_array($tmptable, $listoftablesalreadyadded)) { // We do not add join for main table and tables already added |
|
| 865 | + if (!in_array($tmptable, $listoftablesalreadyadded)) { // We do not add join for main table and tables already added |
|
| 866 | 866 | $tmpforexplode = explode('__', $tmptablealias); |
| 867 | 867 | $endpart = end($tmpforexplode); |
| 868 | 868 | $parenttableandfield = preg_replace('/__'.$endpart.'$/', '', $tmptablealias).'.'.$endpart; |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | //var_dump($arrayofgroupby[$val]); var_dump($tmpval); |
| 890 | 890 | $tmpforloop = dolExplodeIntoArray($arrayofgroupby[$val]['tablefromt'], ','); |
| 891 | 891 | foreach ($tmpforloop as $tmptable => $tmptablealias) { |
| 892 | - if (! in_array($tmptable, $listoftablesalreadyadded)) { // We do not add join for main table and tables already added |
|
| 892 | + if (!in_array($tmptable, $listoftablesalreadyadded)) { // We do not add join for main table and tables already added |
|
| 893 | 893 | $tmpforexplode = explode('__', $tmptablealias); |
| 894 | 894 | $endpart = end($tmpforexplode); |
| 895 | 895 | $parenttableandfield = preg_replace('/__'.$endpart.'$/', '', $tmptablealias).'.'.$endpart; |
@@ -916,7 +916,7 @@ discard block |
||
| 916 | 916 | //var_dump($arrayofgroupby); |
| 917 | 917 | $tmpforloop = dolExplodeIntoArray($arrayofmesures[$val]['tablefromt'], ','); |
| 918 | 918 | foreach ($tmpforloop as $tmptable => $tmptablealias) { |
| 919 | - if (! in_array($tmptable, $listoftablesalreadyadded)) { // We do not add join for main table and tables already added |
|
| 919 | + if (!in_array($tmptable, $listoftablesalreadyadded)) { // We do not add join for main table and tables already added |
|
| 920 | 920 | $tmpforexplode = explode('__', $tmptablealias); |
| 921 | 921 | $endpart = end($tmpforexplode); |
| 922 | 922 | $parenttableandfield = preg_replace('/__'.$endpart.'$/', '', $tmptablealias).'.'.$endpart; |
@@ -951,7 +951,7 @@ discard block |
||
| 951 | 951 | $tmpval = explode('.', $val); |
| 952 | 952 | $tmpforloop = dolExplodeIntoArray($arrayoffilterfields[$val]['tablefromt'], ','); |
| 953 | 953 | foreach ($tmpforloop as $tmptable => $tmptablealias) { |
| 954 | - if (! in_array($tmptable, $listoftablesalreadyadded)) { // We do not add join for main table and tables already added |
|
| 954 | + if (!in_array($tmptable, $listoftablesalreadyadded)) { // We do not add join for main table and tables already added |
|
| 955 | 955 | $tmpforexplode = explode('__', $tmptablealias); |
| 956 | 956 | $endpart = end($tmpforexplode); |
| 957 | 957 | $parenttableandfield = preg_replace('/__'.$endpart.'$/', '', $tmptablealias).'.'.$endpart; |
@@ -987,9 +987,9 @@ discard block |
||
| 987 | 987 | * @param array<int, string> $matches |
| 988 | 988 | * @return string SQL filter condition |
| 989 | 989 | */ |
| 990 | - function (array $matches): string { |
|
| 990 | + function(array $matches): string { |
|
| 991 | 991 | global $db; |
| 992 | - $column = $matches[1] . '.' . $matches[2]; |
|
| 992 | + $column = $matches[1].'.'.$matches[2]; |
|
| 993 | 993 | $operator = $matches[3]; |
| 994 | 994 | $year = (int) $matches[4]; |
| 995 | 995 | $month = (int) $matches[5]; |
@@ -723,7 +723,7 @@ |
||
| 723 | 723 | |
| 724 | 724 | // If not a draft invoice and not temporary invoice |
| 725 | 725 | if ($tmppart !== 'PROV') { |
| 726 | - if ($this instanceOf Facture) { |
|
| 726 | + if ($this instanceof Facture) { |
|
| 727 | 727 | /* @var Facture $this */ |
| 728 | 728 | // If sent by email, we refuse |
| 729 | 729 | if ((int) $this->email_sent_counter > 0) { |
@@ -232,82 +232,82 @@ discard block |
||
| 232 | 232 | /* END MODULEBUILDER TOPMENU */ |
| 233 | 233 | /* BEGIN MODULEBUILDER LEFTMENU CONFERENCEORBOOTH*/ |
| 234 | 234 | $this->menu[$r++] = array( |
| 235 | - 'fk_menu' => 'fk_mainmenu=project', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
| 236 | - 'type' => 'left', // This is a Left menu entry |
|
| 235 | + 'fk_menu' => 'fk_mainmenu=project', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
| 236 | + 'type' => 'left', // This is a Left menu entry |
|
| 237 | 237 | 'titre' => 'EventOrganizationMenuLeft', |
| 238 | 238 | 'prefix' => img_picto('', 'eventorganization', 'class="paddingright pictofixedwidth"'), |
| 239 | 239 | 'mainmenu' => 'project', |
| 240 | 240 | 'leftmenu' => 'eventorganization', |
| 241 | 241 | 'url' => '', |
| 242 | - 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
| 242 | + 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
| 243 | 243 | 'position' => 1000 + $r, |
| 244 | - 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 245 | - 'perms' => '$user->hasRight("project", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
| 244 | + 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 245 | + 'perms' => '$user->hasRight("project", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
| 246 | 246 | 'target' => '', |
| 247 | - 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
| 247 | + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
| 248 | 248 | ); |
| 249 | 249 | $this->menu[$r++] = array( |
| 250 | - 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
| 251 | - 'type' => 'left', // This is a Left menu entry |
|
| 250 | + 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
| 251 | + 'type' => 'left', // This is a Left menu entry |
|
| 252 | 252 | 'titre' => 'New', |
| 253 | 253 | 'url' => '/projet/card.php?leftmenu=projects&action=create&usage_organize_event=1&usage_opportunity=0', |
| 254 | - 'langs' => 'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
| 254 | + 'langs' => 'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
| 255 | 255 | 'position' => 1000 + $r, |
| 256 | - 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 257 | - 'perms' => '$user->hasRight("project", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
| 256 | + 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 257 | + 'perms' => '$user->hasRight("project", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
| 258 | 258 | 'target' => '', |
| 259 | - 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
| 259 | + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
| 260 | 260 | ); |
| 261 | 261 | $this->menu[$r++] = array( |
| 262 | - 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
| 263 | - 'type' => 'left', // This is a Left menu entry |
|
| 262 | + 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
| 263 | + 'type' => 'left', // This is a Left menu entry |
|
| 264 | 264 | 'titre' => 'List', |
| 265 | 265 | 'url' => '/projet/list.php?search_usage_event_organization=1&search_status=99&mainmenu=project&contextpage=organizedevents', |
| 266 | - 'langs' => 'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
| 266 | + 'langs' => 'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
| 267 | 267 | 'position' => 1000 + $r, |
| 268 | - 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 269 | - 'perms' => '$user->hasRight("project", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
| 268 | + 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 269 | + 'perms' => '$user->hasRight("project", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
| 270 | 270 | 'target' => '', |
| 271 | - 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
| 271 | + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
| 272 | 272 | ); |
| 273 | 273 | $this->menu[$r++] = array( |
| 274 | - 'fk_menu' => 'fk_mainmenu=project', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
| 275 | - 'type' => 'left', // This is a Left menu entry |
|
| 274 | + 'fk_menu' => 'fk_mainmenu=project', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
| 275 | + 'type' => 'left', // This is a Left menu entry |
|
| 276 | 276 | 'titre' => 'ConferenceOrBooth', |
| 277 | 277 | 'prefix' => img_picto('', 'conferenceorbooth', 'class="paddingright pictofixedwidth"'), |
| 278 | 278 | 'mainmenu' => 'project', |
| 279 | 279 | 'leftmenu' => 'eventorganizationconforbooth', |
| 280 | 280 | 'url' => '', |
| 281 | - 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
| 281 | + 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
| 282 | 282 | 'position' => 1000 + $r, |
| 283 | - 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 284 | - 'perms' => '$user->hasRight("project", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
| 283 | + 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 284 | + 'perms' => '$user->hasRight("project", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
| 285 | 285 | 'target' => '', |
| 286 | - 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
| 286 | + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
| 287 | 287 | ); |
| 288 | 288 | $this->menu[$r++] = array( |
| 289 | - 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
| 290 | - 'type' => 'left', // This is a Left menu entry |
|
| 289 | + 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
| 290 | + 'type' => 'left', // This is a Left menu entry |
|
| 291 | 291 | 'titre' => 'New', |
| 292 | 292 | 'url' => '/eventorganization/conferenceorbooth_card.php?leftmenu=projects&action=create', |
| 293 | - 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
| 293 | + 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
| 294 | 294 | 'position' => 1000 + $r, |
| 295 | - 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 296 | - 'perms' => '$user->hasRight("project", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
| 295 | + 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 296 | + 'perms' => '$user->hasRight("project", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
| 297 | 297 | 'target' => '', |
| 298 | - 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
| 298 | + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
| 299 | 299 | ); |
| 300 | 300 | $this->menu[$r++] = array( |
| 301 | - 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
| 302 | - 'type' => 'left', // This is a Left menu entry |
|
| 301 | + 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
| 302 | + 'type' => 'left', // This is a Left menu entry |
|
| 303 | 303 | 'titre' => 'List', |
| 304 | 304 | 'url' => '/eventorganization/conferenceorbooth_list.php?mainmenu=project', |
| 305 | - 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
| 305 | + 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
| 306 | 306 | 'position' => 1000 + $r, |
| 307 | - 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 308 | - 'perms' => '$user->hasRight("project", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
| 307 | + 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
| 308 | + 'perms' => '$user->hasRight("project", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
| 309 | 309 | 'target' => '', |
| 310 | - 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
| 310 | + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
| 311 | 311 | ); |
| 312 | 312 | /* END MODULEBUILDER LEFTMENU CONFERENCEORBOOTH */ |
| 313 | 313 | |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | /* BEGIN MODULEBUILDER EXPORT CONFERENCEORBOOTHATTENDEES */ |
| 318 | 318 | $langs->load("eventorganization"); |
| 319 | 319 | $this->export_code[$r] = $this->rights_class.'_'.$r; |
| 320 | - $this->export_label[$r] = 'ListOfAttendeesOfEvent'; // Translation key (used only if key ExportDataset_xxx_z not found) |
|
| 320 | + $this->export_label[$r] = 'ListOfAttendeesOfEvent'; // Translation key (used only if key ExportDataset_xxx_z not found) |
|
| 321 | 321 | $this->export_icon[$r] = $this->picto; |
| 322 | 322 | // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array |
| 323 | 323 | $keyforclass = 'ConferenceOrBoothAttendee'; |
@@ -325,8 +325,8 @@ discard block |
||
| 325 | 325 | $keyforelement = 'conferenceorboothattendee'; |
| 326 | 326 | include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; |
| 327 | 327 | $this->export_entities_array[$r]['t.fk_invoice'] = 'invoice'; |
| 328 | - unset($this->export_fields_array[$r]['t.fk_project']); // Remove field so we can add it at end just after |
|
| 329 | - unset($this->export_fields_array[$r]['t.fk_soc']); // Remove field so we can add it at end just after |
|
| 328 | + unset($this->export_fields_array[$r]['t.fk_project']); // Remove field so we can add it at end just after |
|
| 329 | + unset($this->export_fields_array[$r]['t.fk_soc']); // Remove field so we can add it at end just after |
|
| 330 | 330 | $this->export_fields_array[$r]['t.fk_invoice'] = 'InvoiceId'; |
| 331 | 331 | $this->export_fields_array[$r]['t.fk_project'] = 'ProjectId'; |
| 332 | 332 | $this->export_fields_array[$r]['p.ref'] = 'ProjectRef'; |
@@ -340,9 +340,9 @@ discard block |
||
| 340 | 340 | $this->export_TypeFields_array[$r]['t.fk_soc'] = 'Numeric'; |
| 341 | 341 | //$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text'; |
| 342 | 342 | //unset($this->export_fields_array[$r]['t.fieldtoremove']); |
| 343 | - $keyforselect = 'eventorganization_conferenceorboothattendee'; // The value in column elementtype of llx_extrafields table |
|
| 343 | + $keyforselect = 'eventorganization_conferenceorboothattendee'; // The value in column elementtype of llx_extrafields table |
|
| 344 | 344 | $keyforaliasextra = 'extra'; |
| 345 | - $keyforelement = 'conferenceorboothattendee'; // The value of key for icon and class |
|
| 345 | + $keyforelement = 'conferenceorboothattendee'; // The value of key for icon and class |
|
| 346 | 346 | include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
| 347 | 347 | //$this->export_dependencies_array[$r] = array('aaaline'=>array('tl.rowid','tl.ref')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) |
| 348 | 348 | //$this->export_special_array[$r] = array('t.field'=>'...'); |
@@ -358,16 +358,16 @@ discard block |
||
| 358 | 358 | /* BEGIN MODULEBUILDER EXPORT CONFERENCEORBOOTH */ |
| 359 | 359 | $langs->load("eventorganization"); |
| 360 | 360 | $this->export_code[$r] = $this->rights_class.'_'.$r; |
| 361 | - $this->export_label[$r] = 'ListOfConfOrBoothOfEvent'; // Translation key (used only if key ExportDataset_xxx_z not found) |
|
| 361 | + $this->export_label[$r] = 'ListOfConfOrBoothOfEvent'; // Translation key (used only if key ExportDataset_xxx_z not found) |
|
| 362 | 362 | $this->export_icon[$r] = 'conferenceorbooth'; |
| 363 | 363 | // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array |
| 364 | 364 | $keyforclass = 'ConferenceOrBooth'; |
| 365 | 365 | $keyforclassfile = '/eventorganization/class/conferenceorbooth.class.php'; |
| 366 | 366 | $keyforelement = 'conferenceorbooth'; |
| 367 | 367 | include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; |
| 368 | - unset($this->export_fields_array[$r]['t.fk_action']); // Remove field so we can add it at end just after |
|
| 369 | - unset($this->export_fields_array[$r]['t.fk_project']); // Remove field so we can add it at end just after |
|
| 370 | - unset($this->export_fields_array[$r]['t.fk_soc']); // Remove field so we can add it at end just after |
|
| 368 | + unset($this->export_fields_array[$r]['t.fk_action']); // Remove field so we can add it at end just after |
|
| 369 | + unset($this->export_fields_array[$r]['t.fk_project']); // Remove field so we can add it at end just after |
|
| 370 | + unset($this->export_fields_array[$r]['t.fk_soc']); // Remove field so we can add it at end just after |
|
| 371 | 371 | $this->export_fields_array[$r]['t.fk_action'] = 'ConferenceOrBoothFormatID'; |
| 372 | 372 | $this->export_fields_array[$r]['ca.code'] = 'ConferenceOrBoothFormatCode'; |
| 373 | 373 | $this->export_fields_array[$r]['ca.libelle'] = 'ConferenceOrBoothFormatLabel'; |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | $this->export_TypeFields_array[$r]['s.nom'] = 'Text'; |
| 390 | 390 | //$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text'; |
| 391 | 391 | //unset($this->export_fields_array[$r]['t.fieldtoremove']); |
| 392 | - $keyforselect = 'actioncomm'; // The value in column elementtype of llx_extrafields table |
|
| 392 | + $keyforselect = 'actioncomm'; // The value in column elementtype of llx_extrafields table |
|
| 393 | 393 | $keyforaliasextra = 'extra'; |
| 394 | 394 | $keyforelement = 'conferenceorbooth'; |
| 395 | 395 | include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | $this->date_end = $this->db->jdate($obj->date_end); |
| 590 | 590 | $this->fk_user_creat = $obj->fk_user_creat; |
| 591 | 591 | $this->fk_user_valid = $obj->fk_user_valid; |
| 592 | - $this->status = $obj->status; |
|
| 592 | + $this->status = $obj->status; |
|
| 593 | 593 | $this->progress = $obj->progress; |
| 594 | 594 | $this->budget_amount = $obj->budget_amount; |
| 595 | 595 | $this->priority = $obj->priority; |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | * @param Task $task |
| 726 | 726 | * @return bool |
| 727 | 727 | */ |
| 728 | - static function ($allTasksCompleted, $task) { |
|
| 728 | + static function($allTasksCompleted, $task) { |
|
| 729 | 729 | return $allTasksCompleted && $task->progress >= 100; |
| 730 | 730 | }, |
| 731 | 731 | 1 |
@@ -1359,14 +1359,14 @@ discard block |
||
| 1359 | 1359 | $tasks[$i]->billed = $obj->billed; |
| 1360 | 1360 | } |
| 1361 | 1361 | |
| 1362 | - $tasks[$i]->progress = $obj->progress; |
|
| 1362 | + $tasks[$i]->progress = $obj->progress; |
|
| 1363 | 1363 | $tasks[$i]->fk_statut = $obj->status; |
| 1364 | - $tasks[$i]->status = $obj->status; |
|
| 1364 | + $tasks[$i]->status = $obj->status; |
|
| 1365 | 1365 | $tasks[$i]->public = $obj->public; |
| 1366 | 1366 | $tasks[$i]->date_start = $this->db->jdate($obj->date_start); |
| 1367 | 1367 | $tasks[$i]->date_end = $this->db->jdate($obj->date_end); |
| 1368 | 1368 | $tasks[$i]->rang = $obj->rang; |
| 1369 | - $tasks[$i]->priority = $obj->priority; |
|
| 1369 | + $tasks[$i]->priority = $obj->priority; |
|
| 1370 | 1370 | |
| 1371 | 1371 | $tasks[$i]->socid = $obj->thirdparty_id; // For backward compatibility |
| 1372 | 1372 | $tasks[$i]->thirdparty_id = $obj->thirdparty_id; |
@@ -1710,7 +1710,7 @@ discard block |
||
| 1710 | 1710 | } |
| 1711 | 1711 | |
| 1712 | 1712 | // Update hourly rate of this time spent entry |
| 1713 | - $resql_thm_user = $this->db->query("SELECT thm FROM " . MAIN_DB_PREFIX . "user WHERE rowid = " . ((int) $timespent->fk_user)); |
|
| 1713 | + $resql_thm_user = $this->db->query("SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".((int) $timespent->fk_user)); |
|
| 1714 | 1714 | if (!empty($resql_thm_user)) { |
| 1715 | 1715 | $obj_thm_user = $this->db->fetch_object($resql_thm_user); |
| 1716 | 1716 | $timespent->thm = $obj_thm_user->thm; |
@@ -1792,8 +1792,8 @@ discard block |
||
| 1792 | 1792 | $newobj->fk_project = $obj->project_id; |
| 1793 | 1793 | $newobj->project_ref = $obj->project_ref; |
| 1794 | 1794 | $newobj->project_label = $obj->project_label; |
| 1795 | - $newobj->project_public = $obj->project_public; |
|
| 1796 | - $newobj->public = $obj->project_public; // deprecated |
|
| 1795 | + $newobj->project_public = $obj->project_public; |
|
| 1796 | + $newobj->public = $obj->project_public; // deprecated |
|
| 1797 | 1797 | |
| 1798 | 1798 | $newobj->fk_task = $obj->task_id; |
| 1799 | 1799 | $newobj->task_ref = $obj->task_ref; |
@@ -1807,7 +1807,7 @@ discard block |
||
| 1807 | 1807 | $newobj->timespent_line_duration = $obj->task_duration; |
| 1808 | 1808 | $newobj->timespent_line_fk_user = $obj->fk_user; |
| 1809 | 1809 | $newobj->timespent_line_fk_product = $obj->fk_product; |
| 1810 | - $newobj->timespent_line_thm = $obj->thm; // hourly rate |
|
| 1810 | + $newobj->timespent_line_thm = $obj->thm; // hourly rate |
|
| 1811 | 1811 | $newobj->timespent_line_note = $obj->note; |
| 1812 | 1812 | |
| 1813 | 1813 | $arrayres[] = $newobj; |
@@ -2046,7 +2046,7 @@ discard block |
||
| 2046 | 2046 | $newobj->timespent_withhour = $obj->task_date_withhour; |
| 2047 | 2047 | $newobj->timespent_duration = $obj->task_duration; |
| 2048 | 2048 | $newobj->timespent_fk_user = $obj->fk_user; |
| 2049 | - $newobj->timespent_thm = $obj->thm; // hourly rate |
|
| 2049 | + $newobj->timespent_thm = $obj->thm; // hourly rate |
|
| 2050 | 2050 | $newobj->timespent_note = $obj->note; |
| 2051 | 2051 | |
| 2052 | 2052 | $arrayres[] = $newobj; |
@@ -2110,7 +2110,7 @@ discard block |
||
| 2110 | 2110 | $timespent->element_date = $this->timespent_date; |
| 2111 | 2111 | $timespent->element_datehour = $this->timespent_datehour; |
| 2112 | 2112 | |
| 2113 | - $timespent->element_date_withhour = $this->timespent_withhour; // 0 or 1 |
|
| 2113 | + $timespent->element_date_withhour = $this->timespent_withhour; // 0 or 1 |
|
| 2114 | 2114 | $timespent->element_duration = $this->timespent_duration; |
| 2115 | 2115 | if ($this->timespent_fk_user > 0) { |
| 2116 | 2116 | $timespent->fk_user = $this->timespent_fk_user; |
@@ -2146,14 +2146,14 @@ discard block |
||
| 2146 | 2146 | if ($ret == 1 && (($this->timespent_old_duration != $this->timespent_duration) || getDolGlobalString('TIMESPENT_ALWAYS_UPDATE_THM'))) { |
| 2147 | 2147 | if ($this->timespent_old_duration != $this->timespent_duration) { |
| 2148 | 2148 | // Recalculate amount of time spent for task and update denormalized field |
| 2149 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "projet_task"; |
|
| 2150 | - $sql .= " SET duration_effective = (SELECT SUM(element_duration) FROM " . MAIN_DB_PREFIX . "element_time as ptt where ptt.elementtype = 'task' AND ptt.fk_element = " . ((int) $this->id) . ")"; |
|
| 2149 | + $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task"; |
|
| 2150 | + $sql .= " SET duration_effective = (SELECT SUM(element_duration) FROM ".MAIN_DB_PREFIX."element_time as ptt where ptt.elementtype = 'task' AND ptt.fk_element = ".((int) $this->id).")"; |
|
| 2151 | 2151 | if (isset($this->progress)) { |
| 2152 | - $sql .= ", progress = " . ((float) $this->progress); // Do not overwrite value if not provided |
|
| 2152 | + $sql .= ", progress = ".((float) $this->progress); // Do not overwrite value if not provided |
|
| 2153 | 2153 | } |
| 2154 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
| 2154 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
| 2155 | 2155 | |
| 2156 | - dol_syslog(get_class($this) . "::updateTimeSpent", LOG_DEBUG); |
|
| 2156 | + dol_syslog(get_class($this)."::updateTimeSpent", LOG_DEBUG); |
|
| 2157 | 2157 | if (!$this->db->query($sql)) { |
| 2158 | 2158 | $this->error = $this->db->lasterror(); |
| 2159 | 2159 | $this->db->rollback(); |
@@ -2164,7 +2164,7 @@ discard block |
||
| 2164 | 2164 | // Update hourly rate of this time spent entry, but only if it was not set initially |
| 2165 | 2165 | $res_update = 1; |
| 2166 | 2166 | if (empty($timespent->thm) || getDolGlobalString('TIMESPENT_ALWAYS_UPDATE_THM')) { |
| 2167 | - $resql_thm_user = $this->db->query("SELECT thm FROM " . MAIN_DB_PREFIX . "user WHERE rowid = " . ((int) $timespent->fk_user)); |
|
| 2167 | + $resql_thm_user = $this->db->query("SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".((int) $timespent->fk_user)); |
|
| 2168 | 2168 | if (!empty($resql_thm_user)) { |
| 2169 | 2169 | $obj_thm_user = $this->db->fetch_object($resql_thm_user); |
| 2170 | 2170 | $timespent->thm = $obj_thm_user->thm; |
@@ -2301,8 +2301,8 @@ discard block |
||
| 2301 | 2301 | |
| 2302 | 2302 | $defaultref = ''; |
| 2303 | 2303 | $obj = !getDolGlobalString('PROJECT_TASK_ADDON') ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON; |
| 2304 | - if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').".php")) { |
|
| 2305 | - require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').'.php'; |
|
| 2304 | + if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/".getDolGlobalString('PROJECT_TASK_ADDON').".php")) { |
|
| 2305 | + require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/".getDolGlobalString('PROJECT_TASK_ADDON').'.php'; |
|
| 2306 | 2306 | $modTask = new $obj(); |
| 2307 | 2307 | '@phan-var-force ModeleNumRefTask $modTask'; |
| 2308 | 2308 | $defaultref = $modTask->getNextValue(null, $clone_task); |
@@ -2352,7 +2352,7 @@ discard block |
||
| 2352 | 2352 | } |
| 2353 | 2353 | // End |
| 2354 | 2354 | if ($error) { |
| 2355 | - $clone_task_id = 0; // For static tool check |
|
| 2355 | + $clone_task_id = 0; // For static tool check |
|
| 2356 | 2356 | } else { |
| 2357 | 2357 | $clone_task_id = $clone_task->id; |
| 2358 | 2358 | $clone_task_ref = $clone_task->ref; |
@@ -2792,7 +2792,7 @@ discard block |
||
| 2792 | 2792 | global $langs, $hookmanager, $user, $action; |
| 2793 | 2793 | |
| 2794 | 2794 | $error = 0; |
| 2795 | - $task_origin = new Task($this->db); // The thirdparty that we will delete |
|
| 2795 | + $task_origin = new Task($this->db); // The thirdparty that we will delete |
|
| 2796 | 2796 | |
| 2797 | 2797 | dol_syslog("mergeTask merge task id=".$task_origin_id." (will be deleted) into the task id=".$this->id); |
| 2798 | 2798 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * \remarks To run this script as CLI: phpunit filename.php |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | -global $conf,$user,$langs,$db; |
|
| 28 | +global $conf, $user, $langs, $db; |
|
| 29 | 29 | //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver |
| 30 | 30 | //require_once 'PHPUnit/Autoload.php'; |
| 31 | 31 | require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function testFactureMercure() |
| 57 | 57 | { |
| 58 | - global $conf,$user,$langs,$db,$mysoc; |
|
| 58 | + global $conf, $user, $langs, $db, $mysoc; |
|
| 59 | 59 | $conf = $this->savconf; |
| 60 | 60 | $user = $this->savuser; |
| 61 | 61 | $langs = $this->savlangs; |
@@ -77,50 +77,50 @@ discard block |
||
| 77 | 77 | $localobject->initAsSpecimen(); |
| 78 | 78 | $localobject->fetch_thirdparty(); |
| 79 | 79 | |
| 80 | - $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1915); // we use year 1915 to be sure to not have existing invoice for this year (useful only if numbering is {0000@1} |
|
| 80 | + $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1915); // we use year 1915 to be sure to not have existing invoice for this year (useful only if numbering is {0000@1} |
|
| 81 | 81 | $numbering = new mod_facture_mercure(); |
| 82 | 82 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 83 | 83 | print __METHOD__." result=".$result."\n"; |
| 84 | - $this->assertEquals('1915-0001', $result, 'Test for {yyyy}-{0000}, 1st invoice'); // counter must start to 1 |
|
| 84 | + $this->assertEquals('1915-0001', $result, 'Test for {yyyy}-{0000}, 1st invoice'); // counter must start to 1 |
|
| 85 | 85 | $result2 = $localobject->create($user, 1); |
| 86 | 86 | print __METHOD__." result2=".$result."\n"; |
| 87 | - $result3 = $localobject->validate($user, $result); // create invoice by forcing ref |
|
| 87 | + $result3 = $localobject->validate($user, $result); // create invoice by forcing ref |
|
| 88 | 88 | print __METHOD__." result3=".$result."\n"; |
| 89 | - $this->assertEquals(1, $result3, 'Test validation of invoice with forced ref is ok'); // counter must start to 1 |
|
| 89 | + $this->assertEquals(1, $result3, 'Test validation of invoice with forced ref is ok'); // counter must start to 1 |
|
| 90 | 90 | $result = $localobject->is_erasable(); |
| 91 | 91 | print __METHOD__." is_erasable=".$result."\n"; |
| 92 | - $this->assertGreaterThanOrEqual(1, $result, 'Test for is_erasable, 1st invoice'); // Can be deleted |
|
| 92 | + $this->assertGreaterThanOrEqual(1, $result, 'Test for is_erasable, 1st invoice'); // Can be deleted |
|
| 93 | 93 | |
| 94 | 94 | // We emulate print on invoice 3 times |
| 95 | 95 | $localobject->pos_print_counter = 3; |
| 96 | 96 | $result = $localobject->is_erasable(); |
| 97 | 97 | print __METHOD__." is_erasable=".$result."\n"; |
| 98 | - $this->assertGreaterThanOrEqual(-6, $result, 'Test for is_erasable, 1st invoice already printed'); // Can be deleted |
|
| 98 | + $this->assertGreaterThanOrEqual(-6, $result, 'Test for is_erasable, 1st invoice already printed'); // Can be deleted |
|
| 99 | 99 | |
| 100 | 100 | |
| 101 | 101 | $localobject2 = new Facture($db); |
| 102 | 102 | $localobject2->initAsSpecimen(); |
| 103 | 103 | $localobject2->fetch_thirdparty(); |
| 104 | 104 | |
| 105 | - $localobject2->date = dol_mktime(12, 0, 0, 1, 1, 1916); // we use following year for second invoice (there is no reset into mask) |
|
| 105 | + $localobject2->date = dol_mktime(12, 0, 0, 1, 1, 1916); // we use following year for second invoice (there is no reset into mask) |
|
| 106 | 106 | $numbering = new mod_facture_mercure(); |
| 107 | 107 | $result = $numbering->getNextValue($mysoc, $localobject2, 'last'); |
| 108 | 108 | print __METHOD__." result=".$result."\n"; |
| 109 | 109 | $this->assertEquals('1915-0001', $result, "Test to get last value with param 'last'"); |
| 110 | 110 | $result = $numbering->getNextValue($mysoc, $localobject2); |
| 111 | 111 | print __METHOD__." result=".$result."\n"; |
| 112 | - $this->assertEquals('1916-0002', $result); // counter must be now 2 (not reset) |
|
| 112 | + $this->assertEquals('1916-0002', $result); // counter must be now 2 (not reset) |
|
| 113 | 113 | $result2 = $localobject2->create($user, 1); |
| 114 | 114 | print __METHOD__." result2=".$result."\n"; |
| 115 | - $result3 = $localobject2->validate($user, $result); // create invoice by forcing ref |
|
| 115 | + $result3 = $localobject2->validate($user, $result); // create invoice by forcing ref |
|
| 116 | 116 | print __METHOD__." result3=".$result."\n"; |
| 117 | - $this->assertEquals(1, $result3, 'Test validation of invoice with forced ref is ok'); // counter must start to 1 |
|
| 117 | + $this->assertEquals(1, $result3, 'Test validation of invoice with forced ref is ok'); // counter must start to 1 |
|
| 118 | 118 | $result = $localobject2->is_erasable(); |
| 119 | 119 | print __METHOD__." is_erasable=".$result."\n"; |
| 120 | - $this->assertGreaterThanOrEqual(1, $result); // Can be deleted |
|
| 120 | + $this->assertGreaterThanOrEqual(1, $result); // Can be deleted |
|
| 121 | 121 | $result = $localobject->is_erasable(); |
| 122 | 122 | print __METHOD__." is_erasable=".$result."\n"; |
| 123 | - $this->assertLessThanOrEqual(0, $result, 'Test for {yyyy}-{0000} that is_erasable is 0 for 1st invoice'); // 1 can no more be deleted (2 is more recent) |
|
| 123 | + $this->assertLessThanOrEqual(0, $result, 'Test for {yyyy}-{0000} that is_erasable is 0 for 1st invoice'); // 1 can no more be deleted (2 is more recent) |
|
| 124 | 124 | |
| 125 | 125 | // Now we try with a reset |
| 126 | 126 | $conf->global->FACTURE_MERCURE_MASK_CREDIT = '{yyyy}-{0000@1}'; |
@@ -130,33 +130,33 @@ discard block |
||
| 130 | 130 | $localobject->initAsSpecimen(); |
| 131 | 131 | $localobject->fetch_thirdparty(); |
| 132 | 132 | |
| 133 | - $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1910); // we use year 1910 to be sure to not have existing invoice for this year |
|
| 133 | + $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1910); // we use year 1910 to be sure to not have existing invoice for this year |
|
| 134 | 134 | $numbering = new mod_facture_mercure(); |
| 135 | 135 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 136 | 136 | $result2 = $localobject->create($user, 1); |
| 137 | 137 | $result3 = $localobject->validate($user, $result); |
| 138 | 138 | print __METHOD__." result=".$result."\n"; |
| 139 | - $this->assertEquals('1910-0001', $result, 'Test for {yyyy}-{0000@1} 1st invoice'); // counter must start to 1 |
|
| 139 | + $this->assertEquals('1910-0001', $result, 'Test for {yyyy}-{0000@1} 1st invoice'); // counter must start to 1 |
|
| 140 | 140 | |
| 141 | 141 | $localobject2 = new Facture($db); |
| 142 | 142 | $localobject2->initAsSpecimen(); |
| 143 | 143 | $localobject2->fetch_thirdparty(); |
| 144 | 144 | |
| 145 | - $localobject2->date = dol_mktime(12, 0, 0, 1, 1, 1910); // we use same year for second invoice (and there is a reset required) |
|
| 145 | + $localobject2->date = dol_mktime(12, 0, 0, 1, 1, 1910); // we use same year for second invoice (and there is a reset required) |
|
| 146 | 146 | $numbering = new mod_facture_mercure(); |
| 147 | 147 | $result = $numbering->getNextValue($mysoc, $localobject2); |
| 148 | 148 | print __METHOD__." result=".$result."\n"; |
| 149 | - $this->assertEquals('1910-0002', $result, 'Test for {yyyy}-{0000@1} 2nd invoice, same day'); // counter must be now 2 |
|
| 149 | + $this->assertEquals('1910-0002', $result, 'Test for {yyyy}-{0000@1} 2nd invoice, same day'); // counter must be now 2 |
|
| 150 | 150 | |
| 151 | 151 | $localobject3 = new Facture($db); |
| 152 | 152 | $localobject3->initAsSpecimen(); |
| 153 | 153 | $localobject3->fetch_thirdparty(); |
| 154 | 154 | |
| 155 | - $localobject3->date = dol_mktime(12, 0, 0, 1, 1, 1911); // we use next year for third invoice (and there is a reset required) |
|
| 155 | + $localobject3->date = dol_mktime(12, 0, 0, 1, 1, 1911); // we use next year for third invoice (and there is a reset required) |
|
| 156 | 156 | $numbering = new mod_facture_mercure(); |
| 157 | 157 | $result = $numbering->getNextValue($mysoc, $localobject3); |
| 158 | 158 | print __METHOD__." result=".$result."\n"; |
| 159 | - $this->assertEquals('1911-0001', $result, 'Test for {yyyy}-{0000@1} 3rd invoice, same day'); // counter must be now 1 |
|
| 159 | + $this->assertEquals('1911-0001', $result, 'Test for {yyyy}-{0000@1} 3rd invoice, same day'); // counter must be now 1 |
|
| 160 | 160 | |
| 161 | 161 | // Same but we add month after year |
| 162 | 162 | $conf->global->FACTURE_MERCURE_MASK_CREDIT = '{yyyy}{mm}-{0000@1}'; |
@@ -166,34 +166,34 @@ discard block |
||
| 166 | 166 | $localobject->initAsSpecimen(); |
| 167 | 167 | $localobject->fetch_thirdparty(); |
| 168 | 168 | |
| 169 | - $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1920); // we use year 1920 to be sure to not have existing invoice for this year |
|
| 169 | + $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1920); // we use year 1920 to be sure to not have existing invoice for this year |
|
| 170 | 170 | $numbering = new mod_facture_mercure(); |
| 171 | 171 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 172 | 172 | $result2 = $localobject->create($user, 1); |
| 173 | 173 | $result3 = $localobject->validate($user, $result); |
| 174 | 174 | print __METHOD__." result=".$result."\n"; |
| 175 | - $this->assertEquals('192001-0001', $result, 'Test for {yyyy}{mm}-{0000@1} 1st invoice'); // counter must start to 1 |
|
| 175 | + $this->assertEquals('192001-0001', $result, 'Test for {yyyy}{mm}-{0000@1} 1st invoice'); // counter must start to 1 |
|
| 176 | 176 | $result = $localobject->is_erasable(); |
| 177 | 177 | print __METHOD__." is_erasable=".$result."\n"; |
| 178 | - $this->assertGreaterThanOrEqual(1, $result); // Can be deleted |
|
| 178 | + $this->assertGreaterThanOrEqual(1, $result); // Can be deleted |
|
| 179 | 179 | |
| 180 | 180 | $localobject2 = new Facture($db); |
| 181 | 181 | $localobject2->initAsSpecimen(); |
| 182 | 182 | $localobject2->fetch_thirdparty(); |
| 183 | 183 | |
| 184 | - $localobject2->date = dol_mktime(12, 0, 0, 1, 1, 1921); // we use following year for second invoice (and there is a reset required) |
|
| 184 | + $localobject2->date = dol_mktime(12, 0, 0, 1, 1, 1921); // we use following year for second invoice (and there is a reset required) |
|
| 185 | 185 | $numbering = new mod_facture_mercure(); |
| 186 | 186 | $result = $numbering->getNextValue($mysoc, $localobject2); |
| 187 | 187 | $result2 = $localobject2->create($user, 1); |
| 188 | 188 | $result3 = $localobject2->validate($user, $result); |
| 189 | 189 | print __METHOD__." result=".$result."\n"; |
| 190 | - $this->assertEquals('192101-0001', $result); // counter must be reset to 1 |
|
| 190 | + $this->assertEquals('192101-0001', $result); // counter must be reset to 1 |
|
| 191 | 191 | $result = $localobject2->is_erasable(); |
| 192 | 192 | print __METHOD__." is_erasable=".$result."\n"; |
| 193 | - $this->assertGreaterThanOrEqual(1, $result); // Can be deleted |
|
| 193 | + $this->assertGreaterThanOrEqual(1, $result); // Can be deleted |
|
| 194 | 194 | $result = $localobject->is_erasable(); |
| 195 | 195 | print __METHOD__." is_erasable=".$result."\n"; |
| 196 | - $this->assertGreaterThanOrEqual(1, $result); // Case 1 can be deleted (because there was a reset for case 2) |
|
| 196 | + $this->assertGreaterThanOrEqual(1, $result); // Case 1 can be deleted (because there was a reset for case 2) |
|
| 197 | 197 | |
| 198 | 198 | // Same but we add month before year and use a year on 2 digits |
| 199 | 199 | $conf->global->FACTURE_MERCURE_MASK_CREDIT = '[mm}{yy}-{0000@1}'; |
@@ -201,42 +201,42 @@ discard block |
||
| 201 | 201 | $localobject = new Facture($db); |
| 202 | 202 | $localobject->initAsSpecimen(); |
| 203 | 203 | $localobject->fetch_thirdparty(); |
| 204 | - $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1925); // we use year 1925 to be sure to not have existing invoice for this year |
|
| 204 | + $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1925); // we use year 1925 to be sure to not have existing invoice for this year |
|
| 205 | 205 | $numbering = new mod_facture_mercure(); |
| 206 | 206 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 207 | 207 | $result2 = $localobject->create($user, 1); |
| 208 | 208 | $result3 = $localobject->validate($user, $result); |
| 209 | 209 | print __METHOD__." result=".$result."\n"; |
| 210 | - $this->assertEquals('0125-0001', $result, 'Test for {mm}{yy}-{0000@1} 1st invoice'); // counter must start to 1 |
|
| 211 | - $result = $localobject->is_erasable(); // This call get getNextNumRef with param 'last' |
|
| 210 | + $this->assertEquals('0125-0001', $result, 'Test for {mm}{yy}-{0000@1} 1st invoice'); // counter must start to 1 |
|
| 211 | + $result = $localobject->is_erasable(); // This call get getNextNumRef with param 'last' |
|
| 212 | 212 | print __METHOD__." is_erasable=".$result."\n"; |
| 213 | - $this->assertGreaterThanOrEqual(1, $result); // Can be deleted |
|
| 213 | + $this->assertGreaterThanOrEqual(1, $result); // Can be deleted |
|
| 214 | 214 | |
| 215 | 215 | $localobject2 = new Facture($db); |
| 216 | 216 | $localobject2->initAsSpecimen(); |
| 217 | 217 | $localobject2->fetch_thirdparty(); |
| 218 | - $localobject2->date = dol_mktime(12, 0, 0, 1, 1, 1925); // we use same year 1925 for second invoice (and there is a reset required) |
|
| 218 | + $localobject2->date = dol_mktime(12, 0, 0, 1, 1, 1925); // we use same year 1925 for second invoice (and there is a reset required) |
|
| 219 | 219 | $numbering = new mod_facture_mercure(); |
| 220 | 220 | $result = $numbering->getNextValue($mysoc, $localobject2); |
| 221 | 221 | $result2 = $localobject2->create($user, 1); |
| 222 | 222 | $result3 = $localobject2->validate($user, $result); |
| 223 | 223 | print __METHOD__." result=".$result."\n"; |
| 224 | - $this->assertEquals('0125-0002', $result, 'Test for {mm}{yy}-{0000@1} 2nd invoice'); // counter must be now 2 |
|
| 224 | + $this->assertEquals('0125-0002', $result, 'Test for {mm}{yy}-{0000@1} 2nd invoice'); // counter must be now 2 |
|
| 225 | 225 | $result = $localobject2->is_erasable(); |
| 226 | 226 | print __METHOD__." is_erasable=".$result."\n"; |
| 227 | - $this->assertGreaterThanOrEqual(1, $result); // Can be deleted |
|
| 227 | + $this->assertGreaterThanOrEqual(1, $result); // Can be deleted |
|
| 228 | 228 | $result = $localobject->is_erasable(); |
| 229 | 229 | print __METHOD__." is_erasable=".$result."\n"; |
| 230 | - $this->assertLessThanOrEqual(0, $result); // Case 1 can not be deleted (because there is an invoice 2) |
|
| 230 | + $this->assertLessThanOrEqual(0, $result); // Case 1 can not be deleted (because there is an invoice 2) |
|
| 231 | 231 | |
| 232 | 232 | $localobject3 = new Facture($db); |
| 233 | 233 | $localobject3->initAsSpecimen(); |
| 234 | 234 | $localobject3->fetch_thirdparty(); |
| 235 | - $localobject3->date = dol_mktime(12, 0, 0, 1, 1, 1926); // we use following year for third invoice (and there is a reset required) |
|
| 235 | + $localobject3->date = dol_mktime(12, 0, 0, 1, 1, 1926); // we use following year for third invoice (and there is a reset required) |
|
| 236 | 236 | $numbering = new mod_facture_mercure(); |
| 237 | 237 | $result = $numbering->getNextValue($mysoc, $localobject3); |
| 238 | 238 | print __METHOD__." result=".$result."\n"; |
| 239 | - $this->assertEquals('0126-0001', $result, 'Test for {mm}{yy}-{0000@1} 3rd invoice'); // counter must be now 1 |
|
| 239 | + $this->assertEquals('0126-0001', $result, 'Test for {mm}{yy}-{0000@1} 3rd invoice'); // counter must be now 1 |
|
| 240 | 240 | |
| 241 | 241 | // Try an offset when an invoice already exists |
| 242 | 242 | $conf->global->FACTURE_MERCURE_MASK_CREDIT = '{yyyy}{mm}-{0000+9990}'; |
@@ -251,56 +251,56 @@ discard block |
||
| 251 | 251 | $localobject->initAsSpecimen(); |
| 252 | 252 | $localobject->fetch_thirdparty(); |
| 253 | 253 | |
| 254 | - $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1930); // we use year 1930 to be sure to not have existing invoice for this year |
|
| 254 | + $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1930); // we use year 1930 to be sure to not have existing invoice for this year |
|
| 255 | 255 | $numbering = new mod_facture_mercure(); |
| 256 | 256 | $result = $numbering->getNextValue($mysoc, $localobject, 'last'); |
| 257 | 257 | print __METHOD__." result for last=".$result."\n"; |
| 258 | - $this->assertEquals('', $result); // no existing ref into reset range |
|
| 258 | + $this->assertEquals('', $result); // no existing ref into reset range |
|
| 259 | 259 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 260 | 260 | $result2 = $localobject->create($user, 1); |
| 261 | 261 | $result3 = $localobject->validate($user, $result); |
| 262 | 262 | print __METHOD__." result=".$result."\n"; |
| 263 | - $this->assertEquals('193001-0001', $result); // counter must start to 1 |
|
| 263 | + $this->assertEquals('193001-0001', $result); // counter must start to 1 |
|
| 264 | 264 | $result = $numbering->getNextValue($mysoc, $localobject, 'last'); |
| 265 | 265 | print __METHOD__." result for last=".$result."\n"; |
| 266 | - $this->assertEquals('193001-0001', $result); // last ref into reset range should be same than last created |
|
| 266 | + $this->assertEquals('193001-0001', $result); // last ref into reset range should be same than last created |
|
| 267 | 267 | |
| 268 | 268 | $localobject = new Facture($db); |
| 269 | 269 | $localobject->initAsSpecimen(); |
| 270 | 270 | $localobject->fetch_thirdparty(); |
| 271 | 271 | |
| 272 | - $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1930); // we use same year but fiscal month after |
|
| 272 | + $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1930); // we use same year but fiscal month after |
|
| 273 | 273 | $numbering = new mod_facture_mercure(); |
| 274 | 274 | $result = $numbering->getNextValue($mysoc, $localobject, 'last'); |
| 275 | 275 | print __METHOD__." result for last=".$result."\n"; |
| 276 | - $this->assertEquals('', $result); // last ref into reset range should be '' |
|
| 276 | + $this->assertEquals('', $result); // last ref into reset range should be '' |
|
| 277 | 277 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 278 | 278 | $result2 = $localobject->create($user, 1); |
| 279 | 279 | $result3 = $localobject->validate($user, $result); |
| 280 | 280 | print __METHOD__." result=".$result."\n"; |
| 281 | - $this->assertEquals('193012-0001', $result); // counter must be reset to 1 |
|
| 281 | + $this->assertEquals('193012-0001', $result); // counter must be reset to 1 |
|
| 282 | 282 | |
| 283 | 283 | $localobject = new Facture($db); |
| 284 | 284 | $localobject->initAsSpecimen(); |
| 285 | 285 | $localobject->fetch_thirdparty(); |
| 286 | 286 | |
| 287 | - $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1931); // we use same fiscal year but different year |
|
| 287 | + $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1931); // we use same fiscal year but different year |
|
| 288 | 288 | $numbering = new mod_facture_mercure(); |
| 289 | 289 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 290 | 290 | $result2 = $localobject->create($user, 1); |
| 291 | 291 | $result3 = $localobject->validate($user, $result); |
| 292 | 292 | print __METHOD__." result=".$result."\n"; |
| 293 | - $this->assertEquals('193101-0002', $result); // counter must be 2 |
|
| 293 | + $this->assertEquals('193101-0002', $result); // counter must be 2 |
|
| 294 | 294 | |
| 295 | 295 | $localobject = new Facture($db); |
| 296 | 296 | $localobject->initAsSpecimen(); |
| 297 | 297 | $localobject->fetch_thirdparty(); |
| 298 | 298 | |
| 299 | - $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1931); // we use different fiscal year but same year |
|
| 299 | + $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1931); // we use different fiscal year but same year |
|
| 300 | 300 | $numbering = new mod_facture_mercure(); |
| 301 | 301 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 302 | 302 | print __METHOD__." result=".$result."\n"; |
| 303 | - $this->assertEquals('193112-0001', $result); // counter must be reset to 1 |
|
| 303 | + $this->assertEquals('193112-0001', $result); // counter must be reset to 1 |
|
| 304 | 304 | |
| 305 | 305 | |
| 306 | 306 | // Now we try with a different fiscal month (defined by SOCIETE_FISCAL_MONTH_START) |
@@ -312,47 +312,47 @@ discard block |
||
| 312 | 312 | $localobject->initAsSpecimen(); |
| 313 | 313 | $localobject->fetch_thirdparty(); |
| 314 | 314 | |
| 315 | - $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1940); // we use year 1940 to be sure to not have existing invoice for this year |
|
| 315 | + $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1940); // we use year 1940 to be sure to not have existing invoice for this year |
|
| 316 | 316 | $numbering = new mod_facture_mercure(); |
| 317 | 317 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 318 | 318 | $result2 = $localobject->create($user, 1); |
| 319 | 319 | $result3 = $localobject->validate($user, $result); |
| 320 | 320 | print __METHOD__." result=".$result."\n"; |
| 321 | - $this->assertEquals('194001-0001', $result); // counter must start to 1 |
|
| 321 | + $this->assertEquals('194001-0001', $result); // counter must start to 1 |
|
| 322 | 322 | |
| 323 | 323 | $localobject = new Facture($db); |
| 324 | 324 | $localobject->initAsSpecimen(); |
| 325 | 325 | $localobject->fetch_thirdparty(); |
| 326 | 326 | |
| 327 | - $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1940); // we use same year but fiscal month after |
|
| 327 | + $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1940); // we use same year but fiscal month after |
|
| 328 | 328 | $numbering = new mod_facture_mercure(); |
| 329 | 329 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 330 | 330 | $result2 = $localobject->create($user, 1); |
| 331 | 331 | $result3 = $localobject->validate($user, $result); |
| 332 | 332 | print __METHOD__." result=".$result."\n"; |
| 333 | - $this->assertEquals('194012-0001', $result); // counter must be reset to 1 |
|
| 333 | + $this->assertEquals('194012-0001', $result); // counter must be reset to 1 |
|
| 334 | 334 | |
| 335 | 335 | $localobject = new Facture($db); |
| 336 | 336 | $localobject->initAsSpecimen(); |
| 337 | 337 | $localobject->fetch_thirdparty(); |
| 338 | 338 | |
| 339 | - $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1941); // we use same fiscal year but different year |
|
| 339 | + $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1941); // we use same fiscal year but different year |
|
| 340 | 340 | $numbering = new mod_facture_mercure(); |
| 341 | 341 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 342 | 342 | $result2 = $localobject->create($user, 1); |
| 343 | 343 | $result3 = $localobject->validate($user, $result); |
| 344 | 344 | print __METHOD__." result=".$result."\n"; |
| 345 | - $this->assertEquals('194101-0002', $result); // counter must be 2 |
|
| 345 | + $this->assertEquals('194101-0002', $result); // counter must be 2 |
|
| 346 | 346 | |
| 347 | 347 | $localobject = new Facture($db); |
| 348 | 348 | $localobject->initAsSpecimen(); |
| 349 | 349 | $localobject->fetch_thirdparty(); |
| 350 | 350 | |
| 351 | - $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1941); // we use different discal year but same year |
|
| 351 | + $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1941); // we use different discal year but same year |
|
| 352 | 352 | $numbering = new mod_facture_mercure(); |
| 353 | 353 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 354 | 354 | print __METHOD__." result=".$result."\n"; |
| 355 | - $this->assertEquals('194112-0001', $result); // counter must be reset to 1 |
|
| 355 | + $this->assertEquals('194112-0001', $result); // counter must be reset to 1 |
|
| 356 | 356 | |
| 357 | 357 | |
| 358 | 358 | // Now we try with a different fiscal month (defined by SOCIETE_FISCAL_MONTH_START) and we always want year of element |
@@ -364,47 +364,47 @@ discard block |
||
| 364 | 364 | $localobject->initAsSpecimen(); |
| 365 | 365 | $localobject->fetch_thirdparty(); |
| 366 | 366 | |
| 367 | - $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1950); // we use year 1950 to be sure to not have existing invoice for this year |
|
| 367 | + $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1950); // we use year 1950 to be sure to not have existing invoice for this year |
|
| 368 | 368 | $numbering = new mod_facture_mercure(); |
| 369 | 369 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 370 | 370 | $result2 = $localobject->create($user, 1); |
| 371 | 371 | $result3 = $localobject->validate($user, $result); |
| 372 | 372 | print __METHOD__." result=".$result."\n"; |
| 373 | - $this->assertEquals('195001-0001', $result); // counter must start to 1 |
|
| 373 | + $this->assertEquals('195001-0001', $result); // counter must start to 1 |
|
| 374 | 374 | |
| 375 | 375 | $localobject = new Facture($db); |
| 376 | 376 | $localobject->initAsSpecimen(); |
| 377 | 377 | $localobject->fetch_thirdparty(); |
| 378 | 378 | |
| 379 | - $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1950); // we use same year but fiscal month after |
|
| 379 | + $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1950); // we use same year but fiscal month after |
|
| 380 | 380 | $numbering = new mod_facture_mercure(); |
| 381 | 381 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 382 | 382 | $result2 = $localobject->create($user, 1); |
| 383 | 383 | $result3 = $localobject->validate($user, $result); |
| 384 | 384 | print __METHOD__." result=".$result."\n"; |
| 385 | - $this->assertEquals('195012-0001', $result); // counter must be reset to 1 |
|
| 385 | + $this->assertEquals('195012-0001', $result); // counter must be reset to 1 |
|
| 386 | 386 | |
| 387 | 387 | $localobject = new Facture($db); |
| 388 | 388 | $localobject->initAsSpecimen(); |
| 389 | 389 | $localobject->fetch_thirdparty(); |
| 390 | 390 | |
| 391 | - $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1951); // we use same fiscal year but different year |
|
| 391 | + $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1951); // we use same fiscal year but different year |
|
| 392 | 392 | $numbering = new mod_facture_mercure(); |
| 393 | 393 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 394 | 394 | $result2 = $localobject->create($user, 1); |
| 395 | 395 | $result3 = $localobject->validate($user, $result); |
| 396 | 396 | print __METHOD__." result=".$result."\n"; |
| 397 | - $this->assertEquals('195101-0002', $result); // counter must be 2 |
|
| 397 | + $this->assertEquals('195101-0002', $result); // counter must be 2 |
|
| 398 | 398 | |
| 399 | 399 | $localobject = new Facture($db); |
| 400 | 400 | $localobject->initAsSpecimen(); |
| 401 | 401 | $localobject->fetch_thirdparty(); |
| 402 | 402 | |
| 403 | - $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1951); // we use different discal year but same year |
|
| 403 | + $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1951); // we use different discal year but same year |
|
| 404 | 404 | $numbering = new mod_facture_mercure(); |
| 405 | 405 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 406 | 406 | print __METHOD__." result=".$result."\n"; |
| 407 | - $this->assertEquals('195112-0001', $result); // counter must be reset to 1 |
|
| 407 | + $this->assertEquals('195112-0001', $result); // counter must be reset to 1 |
|
| 408 | 408 | |
| 409 | 409 | |
| 410 | 410 | // Now we try with a different fiscal month (defined by SOCIETE_FISCAL_MONTH_START) and we always want start year |
@@ -416,47 +416,47 @@ discard block |
||
| 416 | 416 | $localobject->initAsSpecimen(); |
| 417 | 417 | $localobject->fetch_thirdparty(); |
| 418 | 418 | |
| 419 | - $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1960); // we use year 1960 to be sure to not have existing invoice for this year |
|
| 419 | + $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1960); // we use year 1960 to be sure to not have existing invoice for this year |
|
| 420 | 420 | $numbering = new mod_facture_mercure(); |
| 421 | 421 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 422 | 422 | $result2 = $localobject->create($user, 1); |
| 423 | 423 | $result3 = $localobject->validate($user, $result); |
| 424 | 424 | print __METHOD__." result=".$result."\n"; |
| 425 | - $this->assertEquals('195901-0001', $result); // counter must start to 1 |
|
| 425 | + $this->assertEquals('195901-0001', $result); // counter must start to 1 |
|
| 426 | 426 | |
| 427 | 427 | $localobject = new Facture($db); |
| 428 | 428 | $localobject->initAsSpecimen(); |
| 429 | 429 | $localobject->fetch_thirdparty(); |
| 430 | 430 | |
| 431 | - $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1960); // we use same year but fiscal month after |
|
| 431 | + $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1960); // we use same year but fiscal month after |
|
| 432 | 432 | $numbering = new mod_facture_mercure(); |
| 433 | 433 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 434 | 434 | $result2 = $localobject->create($user, 1); |
| 435 | 435 | $result3 = $localobject->validate($user, $result); |
| 436 | 436 | print __METHOD__." result=".$result."\n"; |
| 437 | - $this->assertEquals('196012-0001', $result); // counter must be reset to 1 |
|
| 437 | + $this->assertEquals('196012-0001', $result); // counter must be reset to 1 |
|
| 438 | 438 | |
| 439 | 439 | $localobject = new Facture($db); |
| 440 | 440 | $localobject->initAsSpecimen(); |
| 441 | 441 | $localobject->fetch_thirdparty(); |
| 442 | 442 | |
| 443 | - $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1961); // we use same fiscal year but different year |
|
| 443 | + $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1961); // we use same fiscal year but different year |
|
| 444 | 444 | $numbering = new mod_facture_mercure(); |
| 445 | 445 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 446 | 446 | $result2 = $localobject->create($user, 1); |
| 447 | 447 | $result3 = $localobject->validate($user, $result); |
| 448 | 448 | print __METHOD__." result=".$result."\n"; |
| 449 | - $this->assertEquals('196001-0002', $result); // counter must be 2 |
|
| 449 | + $this->assertEquals('196001-0002', $result); // counter must be 2 |
|
| 450 | 450 | |
| 451 | 451 | $localobject = new Facture($db); |
| 452 | 452 | $localobject->initAsSpecimen(); |
| 453 | 453 | $localobject->fetch_thirdparty(); |
| 454 | 454 | |
| 455 | - $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1961); // we use different discal year but same year |
|
| 455 | + $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1961); // we use different discal year but same year |
|
| 456 | 456 | $numbering = new mod_facture_mercure(); |
| 457 | 457 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 458 | 458 | print __METHOD__." result=".$result."\n"; |
| 459 | - $this->assertEquals('196112-0001', $result); // counter must be reset to 1 |
|
| 459 | + $this->assertEquals('196112-0001', $result); // counter must be reset to 1 |
|
| 460 | 460 | |
| 461 | 461 | |
| 462 | 462 | // Now we try with a different fiscal month (defined by SOCIETE_FISCAL_MONTH_START) and we always want end year |
@@ -468,47 +468,47 @@ discard block |
||
| 468 | 468 | $localobject->initAsSpecimen(); |
| 469 | 469 | $localobject->fetch_thirdparty(); |
| 470 | 470 | |
| 471 | - $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1970); // we use year 1970 to be sure to not have existing invoice for this year |
|
| 471 | + $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1970); // we use year 1970 to be sure to not have existing invoice for this year |
|
| 472 | 472 | $numbering = new mod_facture_mercure(); |
| 473 | 473 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 474 | 474 | $result2 = $localobject->create($user, 1); |
| 475 | 475 | $result3 = $localobject->validate($user, $result); |
| 476 | 476 | print __METHOD__." result=".$result."\n"; |
| 477 | - $this->assertEquals('197001-0001', $result); // counter must start to 1 |
|
| 477 | + $this->assertEquals('197001-0001', $result); // counter must start to 1 |
|
| 478 | 478 | |
| 479 | 479 | $localobject = new Facture($db); |
| 480 | 480 | $localobject->initAsSpecimen(); |
| 481 | 481 | $localobject->fetch_thirdparty(); |
| 482 | 482 | |
| 483 | - $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1970); // we use same year but fiscal month after |
|
| 483 | + $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1970); // we use same year but fiscal month after |
|
| 484 | 484 | $numbering = new mod_facture_mercure(); |
| 485 | 485 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 486 | 486 | $result2 = $localobject->create($user, 1); |
| 487 | 487 | $result3 = $localobject->validate($user, $result); |
| 488 | 488 | print __METHOD__." result=".$result."\n"; |
| 489 | - $this->assertEquals('197112-0001', $result); // counter must be reset to 1 |
|
| 489 | + $this->assertEquals('197112-0001', $result); // counter must be reset to 1 |
|
| 490 | 490 | |
| 491 | 491 | $localobject = new Facture($db); |
| 492 | 492 | $localobject->initAsSpecimen(); |
| 493 | 493 | $localobject->fetch_thirdparty(); |
| 494 | 494 | |
| 495 | - $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1971); // we use same fiscal year but different year |
|
| 495 | + $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1971); // we use same fiscal year but different year |
|
| 496 | 496 | $numbering = new mod_facture_mercure(); |
| 497 | 497 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 498 | 498 | $result2 = $localobject->create($user, 1); |
| 499 | 499 | $result3 = $localobject->validate($user, $result); |
| 500 | 500 | print __METHOD__." result=".$result."\n"; |
| 501 | - $this->assertEquals('197101-0002', $result); // counter must be 2 |
|
| 501 | + $this->assertEquals('197101-0002', $result); // counter must be 2 |
|
| 502 | 502 | |
| 503 | 503 | $localobject = new Facture($db); |
| 504 | 504 | $localobject->initAsSpecimen(); |
| 505 | 505 | $localobject->fetch_thirdparty(); |
| 506 | 506 | |
| 507 | - $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1971); // we use different fiscal year but same year |
|
| 507 | + $localobject->date = dol_mktime(12, 0, 0, 12, 1, 1971); // we use different fiscal year but same year |
|
| 508 | 508 | $numbering = new mod_facture_mercure(); |
| 509 | 509 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 510 | 510 | print __METHOD__." result=".$result."\n"; |
| 511 | - $this->assertEquals('197212-0001', $result); // counter must be reset to 1 |
|
| 511 | + $this->assertEquals('197212-0001', $result); // counter must be reset to 1 |
|
| 512 | 512 | |
| 513 | 513 | // Now we try with a reset every month (@99) |
| 514 | 514 | $conf->global->SOCIETE_FISCAL_MONTH_START = 6; |
@@ -519,49 +519,49 @@ discard block |
||
| 519 | 519 | $localobject->initAsSpecimen(); |
| 520 | 520 | $localobject->fetch_thirdparty(); |
| 521 | 521 | |
| 522 | - $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year |
|
| 522 | + $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year |
|
| 523 | 523 | $numbering = new mod_facture_mercure(); |
| 524 | 524 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 525 | 525 | $result2 = $localobject->create($user, 1); |
| 526 | 526 | $result3 = $localobject->validate($user, $result); |
| 527 | 527 | print __METHOD__." result=".$result."\n"; |
| 528 | - $this->assertEquals('198001-0001', $result); // counter must start to 1 |
|
| 528 | + $this->assertEquals('198001-0001', $result); // counter must start to 1 |
|
| 529 | 529 | |
| 530 | 530 | $localobject = new Facture($db); |
| 531 | 531 | $localobject->initAsSpecimen(); |
| 532 | 532 | $localobject->fetch_thirdparty(); |
| 533 | 533 | |
| 534 | - $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year |
|
| 534 | + $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year |
|
| 535 | 535 | $numbering = new mod_facture_mercure(); |
| 536 | 536 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 537 | 537 | $result2 = $localobject->create($user, 1); |
| 538 | 538 | $result3 = $localobject->validate($user, $result); |
| 539 | 539 | print __METHOD__." result=".$result."\n"; |
| 540 | - $this->assertEquals('198001-0002', $result); // counter must start to 2 |
|
| 540 | + $this->assertEquals('198001-0002', $result); // counter must start to 2 |
|
| 541 | 541 | |
| 542 | 542 | $localobject = new Facture($db); |
| 543 | 543 | $localobject->initAsSpecimen(); |
| 544 | 544 | $localobject->fetch_thirdparty(); |
| 545 | 545 | |
| 546 | - $localobject->date = dol_mktime(12, 0, 0, 2, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year |
|
| 546 | + $localobject->date = dol_mktime(12, 0, 0, 2, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year |
|
| 547 | 547 | $numbering = new mod_facture_mercure(); |
| 548 | 548 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 549 | 549 | $result2 = $localobject->create($user, 1); |
| 550 | 550 | $result3 = $localobject->validate($user, $result); |
| 551 | 551 | print __METHOD__." result=".$result."\n"; |
| 552 | - $this->assertEquals('198002-0001', $result); // counter must start to 1 |
|
| 552 | + $this->assertEquals('198002-0001', $result); // counter must start to 1 |
|
| 553 | 553 | |
| 554 | 554 | $localobject = new Facture($db); |
| 555 | 555 | $localobject->initAsSpecimen(); |
| 556 | 556 | $localobject->fetch_thirdparty(); |
| 557 | 557 | |
| 558 | - $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1981); // we use year 1981 to be sure to not have existing invoice for this year |
|
| 558 | + $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1981); // we use year 1981 to be sure to not have existing invoice for this year |
|
| 559 | 559 | $numbering = new mod_facture_mercure(); |
| 560 | 560 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 561 | 561 | $result2 = $localobject->create($user, 1); |
| 562 | 562 | $result3 = $localobject->validate($user, $result); |
| 563 | 563 | print __METHOD__." result=".$result."\n"; |
| 564 | - $this->assertEquals('198101-0001', $result); // counter must start to 1 |
|
| 564 | + $this->assertEquals('198101-0001', $result); // counter must start to 1 |
|
| 565 | 565 | |
| 566 | 566 | // Test with {t} tag |
| 567 | 567 | $conf->global->SOCIETE_FISCAL_MONTH_START = 1; |
@@ -576,13 +576,13 @@ discard block |
||
| 576 | 576 | $localobject->initAsSpecimen(); |
| 577 | 577 | $localobject->fetch_thirdparty(); |
| 578 | 578 | |
| 579 | - $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1982); // we use year 1982 to be sure to not have existing invoice for this year |
|
| 579 | + $localobject->date = dol_mktime(12, 0, 0, 1, 1, 1982); // we use year 1982 to be sure to not have existing invoice for this year |
|
| 580 | 580 | $numbering = new mod_facture_mercure(); |
| 581 | 581 | $result = $numbering->getNextValue($tmpthirdparty, $localobject); |
| 582 | 582 | $result2 = $localobject->create($user, 1); |
| 583 | 583 | $result3 = $localobject->validate($user, $result); |
| 584 | 584 | print __METHOD__." result=".$result."\n"; |
| 585 | - $this->assertEquals('A198201-0001', $result); // counter must start to 1 |
|
| 585 | + $this->assertEquals('A198201-0001', $result); // counter must start to 1 |
|
| 586 | 586 | |
| 587 | 587 | |
| 588 | 588 | return $result; |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | */ |
| 597 | 597 | public function testShipmentSafor() |
| 598 | 598 | { |
| 599 | - global $conf,$user,$langs,$db,$mysoc; |
|
| 599 | + global $conf, $user, $langs, $db, $mysoc; |
|
| 600 | 600 | $conf = $this->savconf; |
| 601 | 601 | $user = $this->savuser; |
| 602 | 602 | $langs = $this->savlangs; |
@@ -609,11 +609,11 @@ discard block |
||
| 609 | 609 | $localobject->initAsSpecimen(); |
| 610 | 610 | $localobject->fetch_thirdparty(); |
| 611 | 611 | |
| 612 | - $localobject->date_creation = dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1915 to be sure to not have existing invoice for this year (useful only if numbering is {0000@1} |
|
| 612 | + $localobject->date_creation = dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1915 to be sure to not have existing invoice for this year (useful only if numbering is {0000@1} |
|
| 613 | 613 | $numbering = new mod_expedition_safor(); |
| 614 | 614 | $result = $numbering->getNextValue($mysoc, $localobject); |
| 615 | 615 | |
| 616 | 616 | print __METHOD__." result=".$result."\n"; |
| 617 | - $this->assertEquals('SH8001-0003', $result); // counter must start to 1 |
|
| 617 | + $this->assertEquals('SH8001-0003', $result); // counter must start to 1 |
|
| 618 | 618 | } |
| 619 | 619 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $offsetunit = GETPOST('offsetunittype_duration', 'aZ09'); |
| 81 | 81 | $remindertype = GETPOST('selectremindertype', 'aZ09'); |
| 82 | 82 | $modelmail = GETPOSTINT('actioncommsendmodel_mail'); |
| 83 | -$complete = GETPOST('complete', 'alpha'); // 'na' must be allowed |
|
| 83 | +$complete = GETPOST('complete', 'alpha'); // 'na' must be allowed |
|
| 84 | 84 | $private = GETPOST('private', 'alphanohtml'); |
| 85 | 85 | if ($complete == 'na' || $complete == -2) { |
| 86 | 86 | $complete = -1; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | 'label' => $langs->trans('BrowserPush'), |
| 165 | 165 | 'disabled' => (getDolGlobalString('AGENDA_REMINDER_BROWSER') ? 0 : 1), |
| 166 | 166 | 'type' => ActionCommReminder::TYPE_USER, |
| 167 | - 'data-html' => img_picto('', 'globe', 'class="pictofixedwidth"') . $langs->trans('BrowserPush'), |
|
| 167 | + 'data-html' => img_picto('', 'globe', 'class="pictofixedwidth"').$langs->trans('BrowserPush'), |
|
| 168 | 168 | ]; |
| 169 | 169 | } |
| 170 | 170 | if (getDolGlobalString('AGENDA_REMINDER_EMAIL')) { |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | 'label' => $langs->trans('EMail'), |
| 173 | 173 | 'disabled' => (getDolGlobalString('AGENDA_REMINDER_EMAIL') ? 0 : 1), |
| 174 | 174 | 'type' => ActionCommReminder::TYPE_USER, |
| 175 | - 'data-html' => img_picto('', 'email', 'class="pictofixedwidth"') . $langs->trans('EMail'), |
|
| 175 | + 'data-html' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans('EMail'), |
|
| 176 | 176 | ]; |
| 177 | 177 | } |
| 178 | 178 | if (getDolGlobalString('AGENDA_REMINDER_SMS')) { |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | 'label' => $langs->trans('Sms'), |
| 182 | 182 | 'disabled' => (getDolGlobalString('MAIN_SMS_SENDMODE') ? 0 : 1), |
| 183 | 183 | 'type' => ActionCommReminder::TYPE_USER, |
| 184 | - 'data-html' => img_picto('', 'phoning_mobile', 'class="pictofixedwidth"') . $langs->trans('Sms'), |
|
| 184 | + 'data-html' => img_picto('', 'phoning_mobile', 'class="pictofixedwidth"').$langs->trans('Sms'), |
|
| 185 | 185 | ]; |
| 186 | 186 | } |
| 187 | 187 | $TDurationTypes = $form->getDurationTypes($langs); |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | if (is_array($listofresourceid) && count($listofresourceid)) { |
| 594 | 594 | foreach ($listofresourceid as $resource_id => $val) { |
| 595 | 595 | $resource_type = 'dolresource'; |
| 596 | - $busy = 1;//GETPOSTINT('busy'); |
|
| 596 | + $busy = 1; //GETPOSTINT('busy'); |
|
| 597 | 597 | |
| 598 | 598 | // Resources association |
| 599 | 599 | if (getDolGlobalString('RESOURCE_USED_IN_EVENT_CHECK')) { |
@@ -609,24 +609,24 @@ discard block |
||
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | $sql = "SELECT er.rowid, r.ref as r_ref, ac.id as ac_id, ac.label as ac_label"; |
| 612 | - $sql .= " FROM " . MAIN_DB_PREFIX . "element_resources as er"; |
|
| 613 | - $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "resource as r ON r.rowid = er.resource_id AND er.resource_type = '" . $db->escape($resource_type) . "'"; |
|
| 614 | - $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "actioncomm as ac ON ac.id = er.element_id AND er.element_type = '" . $db->escape($object->element) . "'"; |
|
| 615 | - $sql .= " WHERE er.resource_id = " . ((int) $resource_id); |
|
| 612 | + $sql .= " FROM ".MAIN_DB_PREFIX."element_resources as er"; |
|
| 613 | + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."resource as r ON r.rowid = er.resource_id AND er.resource_type = '".$db->escape($resource_type)."'"; |
|
| 614 | + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as ac ON ac.id = er.element_id AND er.element_type = '".$db->escape($object->element)."'"; |
|
| 615 | + $sql .= " WHERE er.resource_id = ".((int) $resource_id); |
|
| 616 | 616 | $sql .= " AND er.busy = 1"; |
| 617 | 617 | $sql .= " AND ("; |
| 618 | 618 | |
| 619 | 619 | // event date start between ac.datep and ac.datep2 (if datep2 is null we consider there is no end) |
| 620 | - $sql .= " (ac.datep <= '" . $db->idate($eventDateStart) . "' AND (ac.datep2 IS NULL OR ac.datep2 >= '" . $db->idate($eventDateStart) . "'))"; |
|
| 620 | + $sql .= " (ac.datep <= '".$db->idate($eventDateStart)."' AND (ac.datep2 IS NULL OR ac.datep2 >= '".$db->idate($eventDateStart)."'))"; |
|
| 621 | 621 | // event date end between ac.datep and ac.datep2 |
| 622 | 622 | if (!empty($eventDateEnd)) { |
| 623 | - $sql .= " OR (ac.datep <= '" . $db->idate($eventDateEnd) . "' AND (ac.datep2 >= '" . $db->idate($eventDateEnd) . "'))"; |
|
| 623 | + $sql .= " OR (ac.datep <= '".$db->idate($eventDateEnd)."' AND (ac.datep2 >= '".$db->idate($eventDateEnd)."'))"; |
|
| 624 | 624 | } |
| 625 | 625 | // event date start before ac.datep and event date end after ac.datep2 |
| 626 | 626 | $sql .= " OR ("; |
| 627 | - $sql .= "ac.datep >= '" . $db->idate($eventDateStart) . "'"; |
|
| 627 | + $sql .= "ac.datep >= '".$db->idate($eventDateStart)."'"; |
|
| 628 | 628 | if (!empty($eventDateEnd)) { |
| 629 | - $sql .= " AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '" . $db->idate($eventDateEnd) . "')"; |
|
| 629 | + $sql .= " AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '".$db->idate($eventDateEnd)."')"; |
|
| 630 | 630 | } |
| 631 | 631 | $sql .= ")"; |
| 632 | 632 | |
@@ -640,9 +640,9 @@ discard block |
||
| 640 | 640 | if ($db->num_rows($resql) > 0) { |
| 641 | 641 | // Resource already in use |
| 642 | 642 | $error++; |
| 643 | - $object->error = $langs->trans('ErrorResourcesAlreadyInUse') . ' : '; |
|
| 643 | + $object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : '; |
|
| 644 | 644 | while ($obj = $db->fetch_object($resql)) { |
| 645 | - $object->error .= '<br> - ' . $langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label . ' [' . $obj->ac_id . ']'); |
|
| 645 | + $object->error .= '<br> - '.$langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label.' ['.$obj->ac_id.']'); |
|
| 646 | 646 | } |
| 647 | 647 | $object->errors[] = $object->error; |
| 648 | 648 | |
@@ -746,21 +746,21 @@ discard block |
||
| 746 | 746 | if ($selectedrecurrulefreq == 'WEEKLY' && !empty($selectedrecurrulebyday)) { |
| 747 | 747 | $firstdatearray = dol_get_first_day_week(GETPOSTINT("apday"), GETPOSTINT("apmonth"), GETPOSTINT("apyear")); |
| 748 | 748 | $datep = dol_mktime($fulldayevent ? 0 : GETPOSTINT("aphour"), $fulldayevent ? 0 : GETPOSTINT("apmin"), $fulldayevent ? 0 : GETPOSTINT("apsec"), $firstdatearray['month'], $firstdatearray['first_day'], $firstdatearray['year'], $tzforfullday ? $tzforfullday : 'tzuserrel'); |
| 749 | - $datep = dol_time_plus_duree($datep, $selectedrecurrulebyday + 6, 'd');//We begin the week after |
|
| 749 | + $datep = dol_time_plus_duree($datep, $selectedrecurrulebyday + 6, 'd'); //We begin the week after |
|
| 750 | 750 | $dayoffset = 7; |
| 751 | 751 | $monthoffset = 0; |
| 752 | 752 | $yearoffset = 0; |
| 753 | 753 | } elseif ($selectedrecurrulefreq == 'MONTHLY' && !empty($selectedrecurrulebymonthday)) { |
| 754 | 754 | $firstday = $selectedrecurrulebymonthday; |
| 755 | - $firstmonth = GETPOST("apday") > $selectedrecurrulebymonthday ? GETPOSTINT("apmonth") + 1 : GETPOSTINT("apmonth");//We begin the month after |
|
| 755 | + $firstmonth = GETPOST("apday") > $selectedrecurrulebymonthday ? GETPOSTINT("apmonth") + 1 : GETPOSTINT("apmonth"); //We begin the month after |
|
| 756 | 756 | $datep = dol_mktime($fulldayevent ? 0 : GETPOSTINT("aphour"), $fulldayevent ? 0 : GETPOSTINT("apmin"), $fulldayevent ? 0 : GETPOSTINT("apsec"), $firstmonth, $firstday, GETPOSTINT("apyear"), $tzforfullday ? $tzforfullday : 'tzuserrel'); |
| 757 | - $datep = dol_time_plus_duree($datep, 1, 'm');//We begin the month after |
|
| 757 | + $datep = dol_time_plus_duree($datep, 1, 'm'); //We begin the month after |
|
| 758 | 758 | $dayoffset = 0; |
| 759 | 759 | $monthoffset = 1; |
| 760 | 760 | $yearoffset = 0; |
| 761 | 761 | } elseif ($selectedrecurrulefreq == 'YEARLY' && !empty($selectedrecurrulebyyearmonthday)) { |
| 762 | 762 | $datep = dol_mktime($fulldayevent ? 0 : GETPOSTINT("aphour"), $fulldayevent ? 0 : GETPOSTINT("apmin"), $fulldayevent ? 0 : GETPOSTINT("apsec"), GETPOSTINT("apmonth"), GETPOSTINT("apday"), GETPOSTINT("apyear"), $tzforfullday ? $tzforfullday : 'tzuserrel'); |
| 763 | - $datep = dol_time_plus_duree($datep, 1, 'y');//We begin the year after |
|
| 763 | + $datep = dol_time_plus_duree($datep, 1, 'y'); //We begin the year after |
|
| 764 | 764 | $dayoffset = 0; |
| 765 | 765 | $monthoffset = 0; |
| 766 | 766 | $yearoffset = 1; |
@@ -857,11 +857,11 @@ discard block |
||
| 857 | 857 | |
| 858 | 858 | // increment date for recurrent events |
| 859 | 859 | $datep = dol_time_plus_duree($datep, $dayoffset, 'd'); |
| 860 | - $datep = dol_time_plus_duree($datep, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
|
| 861 | - $datep = dol_time_plus_duree($datep, $yearoffset, 'y'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
|
| 860 | + $datep = dol_time_plus_duree($datep, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
|
| 861 | + $datep = dol_time_plus_duree($datep, $yearoffset, 'y'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
|
| 862 | 862 | $datef = dol_time_plus_duree($datef, $dayoffset, 'd'); |
| 863 | - $datef = dol_time_plus_duree($datef, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
|
| 864 | - $datef = dol_time_plus_duree($datef, $yearoffset, 'y'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
|
| 863 | + $datef = dol_time_plus_duree($datef, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
|
| 864 | + $datef = dol_time_plus_duree($datef, $yearoffset, 'y'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
|
| 865 | 865 | } |
| 866 | 866 | } |
| 867 | 867 | |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | $object->fetch($id); |
| 911 | 911 | $object->fetch_optionals(); |
| 912 | 912 | $object->fetch_userassigned(); |
| 913 | - $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
| 913 | + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
| 914 | 914 | |
| 915 | 915 | // Clean parameters |
| 916 | 916 | if ($fulldayevent) { |
@@ -1210,7 +1210,7 @@ discard block |
||
| 1210 | 1210 | $object->fetch($id); |
| 1211 | 1211 | $object->fetch_optionals(); |
| 1212 | 1212 | $object->fetch_userassigned(); |
| 1213 | - $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
| 1213 | + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
| 1214 | 1214 | |
| 1215 | 1215 | if ($user->hasRight('agenda', 'myactions', 'delete') |
| 1216 | 1216 | || $user->hasRight('agenda', 'allactions', 'delete')) { |
@@ -1232,7 +1232,7 @@ discard block |
||
| 1232 | 1232 | if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate' && $usercancreate) { |
| 1233 | 1233 | $error = 0; |
| 1234 | 1234 | |
| 1235 | - $shour = (int) dol_print_date($object->datep, "%H", 'tzuserrel'); // We take the date visible by user $newdate is also date visible by user. |
|
| 1235 | + $shour = (int) dol_print_date($object->datep, "%H", 'tzuserrel'); // We take the date visible by user $newdate is also date visible by user. |
|
| 1236 | 1236 | $smin = (int) dol_print_date($object->datep, "%M", 'tzuserrel'); |
| 1237 | 1237 | |
| 1238 | 1238 | $newdate = GETPOST('newdate', 'alpha'); |
@@ -1407,7 +1407,7 @@ discard block |
||
| 1407 | 1407 | if (new_startdate > old_enddate) { |
| 1408 | 1408 | var timeDiff = old_enddate - old_startdate; |
| 1409 | 1409 | var new_enddate = new Date(new_startdate.getTime() + timeDiff); |
| 1410 | - $("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput') . '")); |
|
| 1410 | + $("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput').'")); |
|
| 1411 | 1411 | $("#p2day").val(new_enddate.getDate()); |
| 1412 | 1412 | $("#p2month").val(new_enddate.getMonth() + 1); |
| 1413 | 1413 | $("#p2year").val(new_enddate.getFullYear()); |
@@ -1479,7 +1479,7 @@ discard block |
||
| 1479 | 1479 | $default = getDolGlobalString('AGENDA_USE_EVENT_TYPE_DEFAULT', 'AC_RDV'); |
| 1480 | 1480 | print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"'); |
| 1481 | 1481 | $selectedvalue = GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default); |
| 1482 | - print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot |
|
| 1482 | + print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot |
|
| 1483 | 1483 | print '</td></tr>'; |
| 1484 | 1484 | } |
| 1485 | 1485 | |
@@ -1574,7 +1574,7 @@ discard block |
||
| 1574 | 1574 | */ |
| 1575 | 1575 | |
| 1576 | 1576 | // limit date |
| 1577 | - $repeateventlimitdate = empty($repeateventlimitdate) ? (dol_now() + ((24 * 3600 * 365) + 1)) : $repeateventlimitdate; |
|
| 1577 | + $repeateventlimitdate = empty($repeateventlimitdate) ? (dol_now() + ((24 * 3600 * 365) + 1)) : $repeateventlimitdate; |
|
| 1578 | 1578 | |
| 1579 | 1579 | print '<div class="hidden marginrightonly inline-block repeateventlimitdate">'; |
| 1580 | 1580 | print $langs->trans("Until")." "; |
@@ -1858,7 +1858,7 @@ discard block |
||
| 1858 | 1858 | } |
| 1859 | 1859 | //var_dump('origin='.$origin.' originid='.$originid.' hasPermissionOnLinkedObject='.$hasPermissionOnLinkedObject); |
| 1860 | 1860 | |
| 1861 | - if (! in_array($origin, array('societe', 'project', 'project_task', 'user'))) { |
|
| 1861 | + if (!in_array($origin, array('societe', 'project', 'project_task', 'user'))) { |
|
| 1862 | 1862 | // We do not use link for object that already contains a hard coded field to make links with agenda events |
| 1863 | 1863 | print '<tr><td class="titlefieldcreate">'.$langs->trans("LinkedObject").'</td>'; |
| 1864 | 1864 | print '<td colspan="3">'; |
@@ -1948,7 +1948,7 @@ discard block |
||
| 1948 | 1948 | $("#addreminder").prop("checked", true); |
| 1949 | 1949 | |
| 1950 | 1950 | // Set period with default reminder period |
| 1951 | - $("[name=\"offsetvalue\"]").val(\'' . dol_escape_js((string) $reminderDefaultOffset) . '\'); |
|
| 1951 | + $("[name=\"offsetvalue\"]").val(\'' . dol_escape_js((string) $reminderDefaultOffset).'\'); |
|
| 1952 | 1952 | $("#select_offsetunittype_duration").select2("destroy"); |
| 1953 | 1953 | $("#select_offsetunittype_duration").val(\''.dol_escape_js($reminderDefaultUnit).'\'); |
| 1954 | 1954 | $("#select_offsetunittype_duration").select2(); |
@@ -2106,7 +2106,7 @@ discard block |
||
| 2106 | 2106 | if (new_startdate > old_enddate) { |
| 2107 | 2107 | var timeDiff = old_enddate - old_startdate; |
| 2108 | 2108 | var new_enddate = new Date(new_startdate.getTime() + timeDiff); |
| 2109 | - $("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput') . '")); |
|
| 2109 | + $("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput').'")); |
|
| 2110 | 2110 | $("#p2day").val(new_enddate.getDate()); |
| 2111 | 2111 | $("#p2month").val(new_enddate.getMonth() + 1); |
| 2112 | 2112 | $("#p2year").val(new_enddate.getFullYear()); |
@@ -2131,7 +2131,7 @@ discard block |
||
| 2131 | 2131 | if ($backtopage) { |
| 2132 | 2132 | print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : '').'">'; |
| 2133 | 2133 | } |
| 2134 | - if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && ! preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) { |
|
| 2134 | + if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && !preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) { |
|
| 2135 | 2135 | print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">'; |
| 2136 | 2136 | } |
| 2137 | 2137 | |
@@ -2580,7 +2580,7 @@ discard block |
||
| 2580 | 2580 | }); |
| 2581 | 2581 | })'; |
| 2582 | 2582 | print '</script>'."\n"; |
| 2583 | - print '</div>'; // End of div for reminderparameters |
|
| 2583 | + print '</div>'; // End of div for reminderparameters |
|
| 2584 | 2584 | } |
| 2585 | 2585 | |
| 2586 | 2586 | print dol_get_fiche_end(); |
@@ -2861,7 +2861,7 @@ discard block |
||
| 2861 | 2861 | |
| 2862 | 2862 | // Priority |
| 2863 | 2863 | if (getDolGlobalString('AGENDA_SUPPORT_PRIORITY_IN_EVENTS')) { |
| 2864 | - print '<tr><td class="nowrap" class="titlefield">' . $langs->trans("Priority") . '</td><td>'; |
|
| 2864 | + print '<tr><td class="nowrap" class="titlefield">'.$langs->trans("Priority").'</td><td>'; |
|
| 2865 | 2865 | print($object->priority ? $object->priority : ''); |
| 2866 | 2866 | print '</td></tr>'; |
| 2867 | 2867 | } |