@@ -562,8 +562,8 @@ discard block |
||
| 562 | 562 | $sql .= "ip"; |
| 563 | 563 | $sql .= ") VALUES ("; |
| 564 | 564 | $sql .= "'(PROV)', "; |
| 565 | - $sql .= "'".$this->db->idate($now)."', "; // date creation |
|
| 566 | - $sql .= "'".$this->db->idate($this->datep)."', "; // date start event |
|
| 565 | + $sql .= "'".$this->db->idate($now)."', "; // date creation |
|
| 566 | + $sql .= "'".$this->db->idate($this->datep)."', "; // date start event |
|
| 567 | 567 | $sql .= (strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : "null").", "; |
| 568 | 568 | $sql .= ((isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '') ? "'".$this->db->escape($this->durationp)."'" : "null").", "; // deprecated |
| 569 | 569 | $sql .= (isset($this->type_id) ? $this->type_id : "null").","; |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | $resql = $this->db->query($sql); |
| 638 | 638 | if (!$resql) { |
| 639 | 639 | $error++; |
| 640 | - dol_syslog('Error to process userassigned: ' . $this->db->lasterror(), LOG_ERR); |
|
| 640 | + dol_syslog('Error to process userassigned: '.$this->db->lasterror(), LOG_ERR); |
|
| 641 | 641 | $this->errors[] = $this->db->lasterror(); |
| 642 | 642 | } else { |
| 643 | 643 | $already_inserted[$val['id']] = true; |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | $resql = $this->db->query($sql); |
| 663 | 663 | if (!$resql) { |
| 664 | 664 | $error++; |
| 665 | - dol_syslog('Error to process socpeopleassigned: ' . $this->db->lasterror(), LOG_ERR); |
|
| 665 | + dol_syslog('Error to process socpeopleassigned: '.$this->db->lasterror(), LOG_ERR); |
|
| 666 | 666 | $this->errors[] = $this->db->lasterror(); |
| 667 | 667 | } else { |
| 668 | 668 | $already_inserted[$id] = true; |
@@ -1176,7 +1176,7 @@ discard block |
||
| 1176 | 1176 | $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm"; |
| 1177 | 1177 | $sql .= " SET percent = '".$this->db->escape($this->percentage)."'"; |
| 1178 | 1178 | $sql .= ", fk_action = ".(int) $this->type_id; |
| 1179 | - $sql .= ", code = " . ($code ? "'".$this->db->escape($code)."'" : "null"); |
|
| 1179 | + $sql .= ", code = ".($code ? "'".$this->db->escape($code)."'" : "null"); |
|
| 1180 | 1180 | $sql .= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "null"); |
| 1181 | 1181 | $sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null'); |
| 1182 | 1182 | $sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null'); |
@@ -1332,7 +1332,7 @@ discard block |
||
| 1332 | 1332 | $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; |
| 1333 | 1333 | // Fields from hook |
| 1334 | 1334 | $parameters = array('sql' => &$sql, 'socid' => $socid, 'fk_element' => $fk_element, 'elementtype' => $elementtype); |
| 1335 | - $reshook = $hookmanager->executeHooks('getActionsListFrom', $parameters); // Note that $action and $object may have been modified by hook |
|
| 1335 | + $reshook = $hookmanager->executeHooks('getActionsListFrom', $parameters); // Note that $action and $object may have been modified by hook |
|
| 1336 | 1336 | if (!empty($hookmanager->resPrint)) { |
| 1337 | 1337 | $sql .= $hookmanager->resPrint; |
| 1338 | 1338 | } |
@@ -1356,7 +1356,7 @@ discard block |
||
| 1356 | 1356 | } |
| 1357 | 1357 | // Fields where hook |
| 1358 | 1358 | $parameters = array('sql' => &$sql, 'socid' => $socid, 'fk_element' => $fk_element, 'elementtype' => $elementtype); |
| 1359 | - $reshook = $hookmanager->executeHooks('getActionsListWhere', $parameters); // Note that $action and $object may have been modified by hook |
|
| 1359 | + $reshook = $hookmanager->executeHooks('getActionsListWhere', $parameters); // Note that $action and $object may have been modified by hook |
|
| 1360 | 1360 | if (!empty($hookmanager->resPrint)) { |
| 1361 | 1361 | $sql .= $hookmanager->resPrint; |
| 1362 | 1362 | } |
@@ -1433,7 +1433,7 @@ discard block |
||
| 1433 | 1433 | |
| 1434 | 1434 | $resql = $this->db->query($sql); |
| 1435 | 1435 | if ($resql) { |
| 1436 | - $response = null; // Ensure the variable is defined |
|
| 1436 | + $response = null; // Ensure the variable is defined |
|
| 1437 | 1437 | if (empty($load_state_board)) { |
| 1438 | 1438 | $agenda_static = new ActionComm($this->db); |
| 1439 | 1439 | $response = new WorkboardResponse(); |
@@ -1645,9 +1645,9 @@ discard block |
||
| 1645 | 1645 | } |
| 1646 | 1646 | // show categories for this record only in ajax to not overload lists |
| 1647 | 1647 | if (isModEnabled('category') && !$nofetch) { |
| 1648 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 1648 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 1649 | 1649 | $form = new Form($this->db); |
| 1650 | - $datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_ACTIONCOMM, 1); |
|
| 1650 | + $datas['categories'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_ACTIONCOMM, 1); |
|
| 1651 | 1651 | } |
| 1652 | 1652 | |
| 1653 | 1653 | return $datas; |
@@ -1737,8 +1737,8 @@ discard block |
||
| 1737 | 1737 | } |
| 1738 | 1738 | if (!empty($this->note_private)) { |
| 1739 | 1739 | $tooltip .= '<br><hr>'; |
| 1740 | - $texttoshow = dolGetFirstLineOfText($this->note_private, 8); // Try to limit length of content |
|
| 1741 | - $tooltip .= '<div class="tenlinesmax">'; // Restrict height of content into the tooltip |
|
| 1740 | + $texttoshow = dolGetFirstLineOfText($this->note_private, 8); // Try to limit length of content |
|
| 1741 | + $tooltip .= '<div class="tenlinesmax">'; // Restrict height of content into the tooltip |
|
| 1742 | 1742 | $tooltip .= (dol_textishtml($texttoshow) ? str_replace(array("\r", "\n"), "", $texttoshow) : str_replace(array("\r", "\n"), '<br>', $texttoshow)); |
| 1743 | 1743 | $tooltip .= '</div>'; |
| 1744 | 1744 | } |
@@ -2495,7 +2495,7 @@ discard block |
||
| 2495 | 2495 | */ |
| 2496 | 2496 | public static function replaceProduct(DoliDB $dbs, $origin_id, $dest_id) |
| 2497 | 2497 | { |
| 2498 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'actioncomm SET fk_element = ' . ((int) $dest_id) . ' WHERE elementtype="product" AND fk_element = '.((int) $origin_id); |
|
| 2498 | + $sql = 'UPDATE '.MAIN_DB_PREFIX.'actioncomm SET fk_element = '.((int) $dest_id).' WHERE elementtype="product" AND fk_element = '.((int) $origin_id); |
|
| 2499 | 2499 | // using $dbs, not $this->db because function is static |
| 2500 | 2500 | if (!$dbs->query($sql)) { |
| 2501 | 2501 | //$this->errors = $dbs->lasterror(); |
@@ -2620,7 +2620,7 @@ discard block |
||
| 2620 | 2620 | //Select all action comm reminders |
| 2621 | 2621 | $sql = "SELECT rowid as id FROM ".MAIN_DB_PREFIX."actioncomm_reminder"; |
| 2622 | 2622 | $sql .= " WHERE typeremind = 'email'"; |
| 2623 | - $sql .= " AND status = 0"; // 0=No yet sent, -1=Error. TODO Include reminder in error once we can count number of error, so we can try 5 times and not more on errors. |
|
| 2623 | + $sql .= " AND status = 0"; // 0=No yet sent, -1=Error. TODO Include reminder in error once we can count number of error, so we can try 5 times and not more on errors. |
|
| 2624 | 2624 | $sql .= " AND dateremind <= '".$this->db->idate($now)."'"; |
| 2625 | 2625 | $sql .= " AND entity IN (".getEntity('actioncomm').")"; |
| 2626 | 2626 | $sql .= $this->db->order("dateremind", "ASC"); |
@@ -2629,7 +2629,7 @@ discard block |
||
| 2629 | 2629 | if ($resql) { |
| 2630 | 2630 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
| 2631 | 2631 | $formmail = new FormMail($this->db); |
| 2632 | - $to = null; // Ensure 'to' is defined for static analysis |
|
| 2632 | + $to = null; // Ensure 'to' is defined for static analysis |
|
| 2633 | 2633 | |
| 2634 | 2634 | while ($obj = $this->db->fetch_object($resql)) { |
| 2635 | 2635 | $res = $actionCommReminder->fetch($obj->id); |
@@ -472,10 +472,10 @@ |
||
| 472 | 472 | |
| 473 | 473 | |
| 474 | 474 | /** |
| 475 | - * testGetBrowserInfo |
|
| 476 | - * |
|
| 477 | - * @return void |
|
| 478 | - */ |
|
| 475 | + * testGetBrowserInfo |
|
| 476 | + * |
|
| 477 | + * @return void |
|
| 478 | + */ |
|
| 479 | 479 | public function testGetBrowserInfo() |
| 480 | 480 | { |
| 481 | 481 | // MSIE 5.0 |
@@ -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,$mysoc; |
|
| 28 | +global $conf, $user, $langs, $db, $mysoc; |
|
| 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'; |
@@ -33,35 +33,35 @@ discard block |
||
| 33 | 33 | require_once dirname(__FILE__).'/../../htdocs/product/class/product.class.php'; |
| 34 | 34 | require_once dirname(__FILE__).'/CommonClassTest.class.php'; |
| 35 | 35 | |
| 36 | -if (! defined('NOREQUIREUSER')) { |
|
| 36 | +if (!defined('NOREQUIREUSER')) { |
|
| 37 | 37 | define('NOREQUIREUSER', '1'); |
| 38 | 38 | } |
| 39 | -if (! defined('NOREQUIREDB')) { |
|
| 39 | +if (!defined('NOREQUIREDB')) { |
|
| 40 | 40 | define('NOREQUIREDB', '1'); |
| 41 | 41 | } |
| 42 | -if (! defined('NOREQUIRESOC')) { |
|
| 42 | +if (!defined('NOREQUIRESOC')) { |
|
| 43 | 43 | define('NOREQUIRESOC', '1'); |
| 44 | 44 | } |
| 45 | -if (! defined('NOREQUIRETRAN')) { |
|
| 45 | +if (!defined('NOREQUIRETRAN')) { |
|
| 46 | 46 | define('NOREQUIRETRAN', '1'); |
| 47 | 47 | } |
| 48 | -if (! defined('NOCSRFCHECK')) { |
|
| 48 | +if (!defined('NOCSRFCHECK')) { |
|
| 49 | 49 | define('NOCSRFCHECK', '1'); |
| 50 | 50 | } |
| 51 | -if (! defined('NOTOKENRENEWAL')) { |
|
| 51 | +if (!defined('NOTOKENRENEWAL')) { |
|
| 52 | 52 | define('NOTOKENRENEWAL', '1'); |
| 53 | 53 | } |
| 54 | -if (! defined('NOREQUIREMENU')) { |
|
| 54 | +if (!defined('NOREQUIREMENU')) { |
|
| 55 | 55 | define('NOREQUIREMENU', '1'); // If there is no menu to show |
| 56 | 56 | } |
| 57 | -if (! defined('NOREQUIREHTML')) { |
|
| 57 | +if (!defined('NOREQUIREHTML')) { |
|
| 58 | 58 | define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php |
| 59 | 59 | } |
| 60 | -if (! defined('NOREQUIREAJAX')) { |
|
| 60 | +if (!defined('NOREQUIREAJAX')) { |
|
| 61 | 61 | define('NOREQUIREAJAX', '1'); |
| 62 | 62 | } |
| 63 | -if (! defined("NOLOGIN")) { |
|
| 64 | - define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
| 63 | +if (!defined("NOLOGIN")) { |
|
| 64 | + define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | print "\n".$langs->trans("CurrentTimeZone").' : '.getServerTimeZoneString(); |
@@ -85,10 +85,10 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public static function setUpBeforeClass(): void |
| 87 | 87 | { |
| 88 | - global $conf,$user,$langs,$db; |
|
| 88 | + global $conf, $user, $langs, $db; |
|
| 89 | 89 | //$db->begin(); // This is to have all actions inside a transaction even if test launched without suite. |
| 90 | 90 | |
| 91 | - if (! function_exists('mb_substr')) { |
|
| 91 | + if (!function_exists('mb_substr')) { |
|
| 92 | 92 | print "\n".__METHOD__." function mb_substr must be enabled.\n"; |
| 93 | 93 | die(1); |
| 94 | 94 | } |
@@ -256,9 +256,9 @@ discard block |
||
| 256 | 256 | $sql = forgeSQLFromUniversalSearchCriteria($filter); |
| 257 | 257 | |
| 258 | 258 | if ($db->type == 'mysqli') { |
| 259 | - $this->assertEquals(" AND ((t.fieldstring = 'aaa\'ttt'))", $sql); // with mysql |
|
| 259 | + $this->assertEquals(" AND ((t.fieldstring = 'aaa\'ttt'))", $sql); // with mysql |
|
| 260 | 260 | } else { |
| 261 | - $this->assertEquals(" AND ((t.fieldstring = 'aaa''ttt'))", $sql); // with pgsql |
|
| 261 | + $this->assertEquals(" AND ((t.fieldstring = 'aaa''ttt'))", $sql); // with pgsql |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | $filter = "(t.fk_soc:IN:1,2)"; |
@@ -677,13 +677,13 @@ discard block |
||
| 677 | 677 | $input = 'xxx < br>'; |
| 678 | 678 | $after = dol_textishtml($input); |
| 679 | 679 | $this->assertFalse($after); |
| 680 | - $input = 'xxx <[email protected]>'; // <em> is html, <em... is not |
|
| 680 | + $input = 'xxx <[email protected]>'; // <em> is html, <em... is not |
|
| 681 | 681 | $after = dol_textishtml($input); |
| 682 | 682 | $this->assertFalse($after); |
| 683 | 683 | $input = 'xxx <brstyle="ee">'; |
| 684 | 684 | $after = dol_textishtml($input); |
| 685 | 685 | $this->assertFalse($after); |
| 686 | - $input = 'This is a text with html comments <!-- comment -->'; // we suppose this is not enough to be html content |
|
| 686 | + $input = 'This is a text with html comments <!-- comment -->'; // we suppose this is not enough to be html content |
|
| 687 | 687 | $after = dol_textishtml($input); |
| 688 | 688 | $this->assertFalse($after); |
| 689 | 689 | |
@@ -739,17 +739,17 @@ discard block |
||
| 739 | 739 | public function testDolConcat() |
| 740 | 740 | { |
| 741 | 741 | $text1 = "A string 1"; |
| 742 | - $text2 = "A string 2"; // text 1 and 2 are text, concat need only \n |
|
| 742 | + $text2 = "A string 2"; // text 1 and 2 are text, concat need only \n |
|
| 743 | 743 | $after = dol_concatdesc($text1, $text2); |
| 744 | 744 | $this->assertEquals("A string 1\nA string 2", $after); |
| 745 | 745 | |
| 746 | 746 | $text1 = "A<br>string 1"; |
| 747 | - $text2 = "A string 2"; // text 1 is html, concat need <br>\n |
|
| 747 | + $text2 = "A string 2"; // text 1 is html, concat need <br>\n |
|
| 748 | 748 | $after = dol_concatdesc($text1, $text2); |
| 749 | 749 | $this->assertEquals("A<br>string 1<br>\nA string 2", $after); |
| 750 | 750 | |
| 751 | 751 | $text1 = "A string 1"; |
| 752 | - $text2 = "A <b>string</b> 2"; // text 2 is html, concat need <br>\n |
|
| 752 | + $text2 = "A <b>string</b> 2"; // text 2 is html, concat need <br>\n |
|
| 753 | 753 | $after = dol_concatdesc($text1, $text2); |
| 754 | 754 | $this->assertEquals("A string 1<br>\nA <b>string</b> 2", $after); |
| 755 | 755 | |
@@ -851,19 +851,19 @@ discard block |
||
| 851 | 851 | // Text not already HTML |
| 852 | 852 | |
| 853 | 853 | $input = "A string\nwith a é, &, < and >."; |
| 854 | - $after = dol_htmlentitiesbr($input, 0); // Add <br> before \n |
|
| 854 | + $after = dol_htmlentitiesbr($input, 0); // Add <br> before \n |
|
| 855 | 855 | $this->assertEquals("A string<br>\nwith a é, &, < and >.", $after); |
| 856 | 856 | |
| 857 | 857 | $input = "A string\nwith a é, &, < and >."; |
| 858 | - $after = dol_htmlentitiesbr($input, 1); // Replace \n with <br> |
|
| 858 | + $after = dol_htmlentitiesbr($input, 1); // Replace \n with <br> |
|
| 859 | 859 | $this->assertEquals("A string<br>with a é, &, < and >.", $after); |
| 860 | 860 | |
| 861 | - $input = "A string\nwith a é, &, < and >.\n\n"; // With some \n at end that should be cleaned |
|
| 862 | - $after = dol_htmlentitiesbr($input, 0); // Add <br> before \n |
|
| 861 | + $input = "A string\nwith a é, &, < and >.\n\n"; // With some \n at end that should be cleaned |
|
| 862 | + $after = dol_htmlentitiesbr($input, 0); // Add <br> before \n |
|
| 863 | 863 | $this->assertEquals("A string<br>\nwith a é, &, < and >.", $after); |
| 864 | 864 | |
| 865 | - $input = "A string\nwith a é, &, < and >.\n\n"; // With some \n at end that should be cleaned |
|
| 866 | - $after = dol_htmlentitiesbr($input, 1); // Replace \n with <br> |
|
| 865 | + $input = "A string\nwith a é, &, < and >.\n\n"; // With some \n at end that should be cleaned |
|
| 866 | + $after = dol_htmlentitiesbr($input, 1); // Replace \n with <br> |
|
| 867 | 867 | $this->assertEquals("A string<br>with a é, &, < and >.", $after); |
| 868 | 868 | |
| 869 | 869 | // Text already HTML, so &,<,> should not be converted |
@@ -876,11 +876,11 @@ discard block |
||
| 876 | 876 | $after = dol_htmlentitiesbr($input); |
| 877 | 877 | $this->assertEquals("<li>\nA string with a é, &, < and >.</li>\nAnother string", $after); |
| 878 | 878 | |
| 879 | - $input = "A string<br>\nwith a é, &, < and >.<br>"; // With some <br> at end that should be cleaned |
|
| 879 | + $input = "A string<br>\nwith a é, &, < and >.<br>"; // With some <br> at end that should be cleaned |
|
| 880 | 880 | $after = dol_htmlentitiesbr($input); |
| 881 | 881 | $this->assertEquals("A string<br>\nwith a é, &, < and >.", $after); |
| 882 | 882 | |
| 883 | - $input = "<li>\nA string with a é, &, < and >.</li>\nAnother string<br>"; // With some <br> at end that should be cleaned |
|
| 883 | + $input = "<li>\nA string with a é, &, < and >.</li>\nAnother string<br>"; // With some <br> at end that should be cleaned |
|
| 884 | 884 | $after = dol_htmlentitiesbr($input); |
| 885 | 885 | $this->assertEquals("<li>\nA string with a é, &, < and >.</li>\nAnother string", $after); |
| 886 | 886 | |
@@ -1044,43 +1044,43 @@ discard block |
||
| 1044 | 1044 | date_default_timezone_set('UTC'); |
| 1045 | 1045 | |
| 1046 | 1046 | // Check bad hours |
| 1047 | - $result = dol_mktime(25, 0, 0, 1, 1, 1970, 1, 1); // Error (25 hours) |
|
| 1047 | + $result = dol_mktime(25, 0, 0, 1, 1, 1970, 1, 1); // Error (25 hours) |
|
| 1048 | 1048 | print __METHOD__." result=".$result."\n"; |
| 1049 | 1049 | $this->assertEquals('', $result); |
| 1050 | - $result = dol_mktime(2, 61, 0, 1, 1, 1970, 1, 1); // Error (61 minutes) |
|
| 1050 | + $result = dol_mktime(2, 61, 0, 1, 1, 1970, 1, 1); // Error (61 minutes) |
|
| 1051 | 1051 | print __METHOD__." result=".$result."\n"; |
| 1052 | 1052 | $this->assertEquals('', $result); |
| 1053 | - $result = dol_mktime(2, 1, 61, 1, 1, 1970, 1, 1); // Error (61 seconds) |
|
| 1053 | + $result = dol_mktime(2, 1, 61, 1, 1, 1970, 1, 1); // Error (61 seconds) |
|
| 1054 | 1054 | print __METHOD__." result=".$result."\n"; |
| 1055 | 1055 | $this->assertEquals('', $result); |
| 1056 | - $result = dol_mktime(2, 1, 1, 1, 32, 1970, 1, 1); // Error (day 32) |
|
| 1056 | + $result = dol_mktime(2, 1, 1, 1, 32, 1970, 1, 1); // Error (day 32) |
|
| 1057 | 1057 | print __METHOD__." result=".$result."\n"; |
| 1058 | 1058 | $this->assertEquals('', $result); |
| 1059 | - $result = dol_mktime(2, 1, 1, 13, 1, 1970, 1, 1); // Error (month 13) |
|
| 1059 | + $result = dol_mktime(2, 1, 1, 13, 1, 1970, 1, 1); // Error (month 13) |
|
| 1060 | 1060 | print __METHOD__." result=".$result."\n"; |
| 1061 | 1061 | $this->assertEquals('', $result); |
| 1062 | 1062 | |
| 1063 | - $result = dol_mktime(2, 1, 1, 1, 1, 1970, 1); // 1970-01-01 02:01:01 in GMT area -> 7261 |
|
| 1063 | + $result = dol_mktime(2, 1, 1, 1, 1, 1970, 1); // 1970-01-01 02:01:01 in GMT area -> 7261 |
|
| 1064 | 1064 | print __METHOD__." result=".$result."\n"; |
| 1065 | 1065 | $this->assertEquals(7261, $result); |
| 1066 | 1066 | |
| 1067 | - $result = dol_mktime(2, 0, 0, 1, 1, 1970, 0); // 1970-01-01 02:00:00 = 7200 in local area Europe/Paris = 3600 GMT |
|
| 1067 | + $result = dol_mktime(2, 0, 0, 1, 1, 1970, 0); // 1970-01-01 02:00:00 = 7200 in local area Europe/Paris = 3600 GMT |
|
| 1068 | 1068 | print __METHOD__." result=".$result."\n"; |
| 1069 | - $tz = getServerTimeZoneInt('winter'); // +1 in Europe/Paris at this time (this time is winter) |
|
| 1070 | - $this->assertEquals(7200 - ($tz * 3600), $result); // 7200 if we are at greenwich winter, 7200-($tz*3600) at local winter |
|
| 1069 | + $tz = getServerTimeZoneInt('winter'); // +1 in Europe/Paris at this time (this time is winter) |
|
| 1070 | + $this->assertEquals(7200 - ($tz * 3600), $result); // 7200 if we are at greenwich winter, 7200-($tz*3600) at local winter |
|
| 1071 | 1071 | |
| 1072 | 1072 | // Some test for local TZ Europe/Paris |
| 1073 | 1073 | date_default_timezone_set('Europe/Paris'); |
| 1074 | 1074 | |
| 1075 | 1075 | // Check that tz for paris in winter is used |
| 1076 | - $result = dol_mktime(2, 0, 0, 1, 1, 1970, 'server'); // 1970-01-01 02:00:00 = 7200 in local area Europe/Paris = 3600 GMT |
|
| 1076 | + $result = dol_mktime(2, 0, 0, 1, 1, 1970, 'server'); // 1970-01-01 02:00:00 = 7200 in local area Europe/Paris = 3600 GMT |
|
| 1077 | 1077 | print __METHOD__." result=".$result."\n"; |
| 1078 | - $this->assertEquals(3600, $result); // 7200 if we are at greenwich winter, 3600 at Europe/Paris |
|
| 1078 | + $this->assertEquals(3600, $result); // 7200 if we are at greenwich winter, 3600 at Europe/Paris |
|
| 1079 | 1079 | |
| 1080 | 1080 | // Check that daylight saving time is used |
| 1081 | - $result = dol_mktime(2, 0, 0, 6, 1, 2014, 0); // 2014-06-01 02:00:00 = 1401588000-3600(location)-3600(daylight) in local area Europe/Paris = 1401588000 GMT |
|
| 1081 | + $result = dol_mktime(2, 0, 0, 6, 1, 2014, 0); // 2014-06-01 02:00:00 = 1401588000-3600(location)-3600(daylight) in local area Europe/Paris = 1401588000 GMT |
|
| 1082 | 1082 | print __METHOD__." result=".$result."\n"; |
| 1083 | - $this->assertEquals(1401588000 - 3600 - 3600, $result); // 1401588000 are at greenwich summer, 1401588000-3600(location)-3600(daylight) at Europe/Paris summer |
|
| 1083 | + $this->assertEquals(1401588000 - 3600 - 3600, $result); // 1401588000 are at greenwich summer, 1401588000-3600(location)-3600(daylight) at Europe/Paris summer |
|
| 1084 | 1084 | |
| 1085 | 1085 | date_default_timezone_set($savtz); |
| 1086 | 1086 | } |
@@ -1093,7 +1093,7 @@ discard block |
||
| 1093 | 1093 | */ |
| 1094 | 1094 | public function testDolEscapeJs() |
| 1095 | 1095 | { |
| 1096 | - $input = "x&<b>#</b>,\"'"; // " will be converted into ' |
|
| 1096 | + $input = "x&<b>#</b>,\"'"; // " will be converted into ' |
|
| 1097 | 1097 | $result = dol_escape_js($input); |
| 1098 | 1098 | $this->assertEquals("x&<b>#</b>,\'\'", $result, "Test mode=0"); |
| 1099 | 1099 | |
@@ -1112,15 +1112,15 @@ discard block |
||
| 1112 | 1112 | */ |
| 1113 | 1113 | public function testDolEscapeHtmlTag() |
| 1114 | 1114 | { |
| 1115 | - $input = 'x&<b>#</b>,"'; // & and " are converted into html entities, <b> are removed |
|
| 1115 | + $input = 'x&<b>#</b>,"'; // & and " are converted into html entities, <b> are removed |
|
| 1116 | 1116 | $result = dol_escape_htmltag($input); |
| 1117 | 1117 | $this->assertEquals('x&#,"', $result); |
| 1118 | 1118 | |
| 1119 | - $input = 'x&<b>#</b>,"'; // & and " are converted into html entities, <b> are not removed |
|
| 1119 | + $input = 'x&<b>#</b>,"'; // & and " are converted into html entities, <b> are not removed |
|
| 1120 | 1120 | $result = dol_escape_htmltag($input, 1); |
| 1121 | 1121 | $this->assertEquals('x&<b>#</b>,"', $result); |
| 1122 | 1122 | |
| 1123 | - $input = '<img alt="" src="https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png">'; // & and " are converted into html entities, <b> are not removed |
|
| 1123 | + $input = '<img alt="" src="https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png">'; // & and " are converted into html entities, <b> are not removed |
|
| 1124 | 1124 | $result = dol_escape_htmltag($input, 1, 1, 'common', 0, 1); |
| 1125 | 1125 | $this->assertEquals('<img alt="" src="https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png">', $result); |
| 1126 | 1126 | |
@@ -1145,7 +1145,7 @@ discard block |
||
| 1145 | 1145 | */ |
| 1146 | 1146 | public function testDolFormatAddress() |
| 1147 | 1147 | { |
| 1148 | - global $conf,$user,$langs,$db; |
|
| 1148 | + global $conf, $user, $langs, $db; |
|
| 1149 | 1149 | $conf = $this->savconf; |
| 1150 | 1150 | $user = $this->savuser; |
| 1151 | 1151 | $langs = $this->savlangs; |
@@ -1183,7 +1183,7 @@ discard block |
||
| 1183 | 1183 | */ |
| 1184 | 1184 | public function testDolPrintPhone() |
| 1185 | 1185 | { |
| 1186 | - global $conf,$user,$langs,$db; |
|
| 1186 | + global $conf, $user, $langs, $db; |
|
| 1187 | 1187 | $conf = $this->savconf; |
| 1188 | 1188 | $user = $this->savuser; |
| 1189 | 1189 | $langs = $this->savlangs; |
@@ -1262,13 +1262,13 @@ discard block |
||
| 1262 | 1262 | public function verifCondDataProvider(): array |
| 1263 | 1263 | { |
| 1264 | 1264 | return [ |
| 1265 | - 'Test a true comparison' => ['1==1', true,], |
|
| 1266 | - 'Test a false comparison' => ['1==2', false,], |
|
| 1267 | - 'Test that the conf property of a module reports true when enabled' => ['isModEnabled("facture")', true,], |
|
| 1268 | - 'Test that the conf property of a module reports false when disabled' => ['isModEnabled("moduledummy")', false,], |
|
| 1269 | - 'Test that verifConf(0) returns false' => [0, false,], |
|
| 1270 | - 'Test that verifConf("0") returns false' => ["0", false,], |
|
| 1271 | - 'Test that verifConf("") returns false (special case)' => ['', true,], |
|
| 1265 | + 'Test a true comparison' => ['1==1', true, ], |
|
| 1266 | + 'Test a false comparison' => ['1==2', false, ], |
|
| 1267 | + 'Test that the conf property of a module reports true when enabled' => ['isModEnabled("facture")', true, ], |
|
| 1268 | + 'Test that the conf property of a module reports false when disabled' => ['isModEnabled("moduledummy")', false, ], |
|
| 1269 | + 'Test that verifConf(0) returns false' => [0, false, ], |
|
| 1270 | + 'Test that verifConf("0") returns false' => ["0", false, ], |
|
| 1271 | + 'Test that verifConf("") returns false (special case)' => ['', true, ], |
|
| 1272 | 1272 | ]; |
| 1273 | 1273 | } |
| 1274 | 1274 | |
@@ -1298,7 +1298,7 @@ discard block |
||
| 1298 | 1298 | */ |
| 1299 | 1299 | public function testGetDefaultTva() |
| 1300 | 1300 | { |
| 1301 | - global $conf,$user,$langs,$db; |
|
| 1301 | + global $conf, $user, $langs, $db; |
|
| 1302 | 1302 | $this->savconf = $conf; |
| 1303 | 1303 | $this->savuser = $user; |
| 1304 | 1304 | $this->savlangs = $langs; |
@@ -1401,7 +1401,7 @@ discard block |
||
| 1401 | 1401 | */ |
| 1402 | 1402 | public function testGetDefaultLocalTax() |
| 1403 | 1403 | { |
| 1404 | - global $conf,$user,$langs,$db; |
|
| 1404 | + global $conf, $user, $langs, $db; |
|
| 1405 | 1405 | $this->savconf = $conf; |
| 1406 | 1406 | $this->savuser = $user; |
| 1407 | 1407 | $this->savlangs = $langs; |
@@ -1457,7 +1457,7 @@ discard block |
||
| 1457 | 1457 | $vat1 = get_default_localtax($companyes, $companyes, 1, 0); |
| 1458 | 1458 | $vat2 = get_default_localtax($companyes, $companyes, 2, 0); |
| 1459 | 1459 | $this->assertEquals($vat1, 5.2); |
| 1460 | - $this->assertStringStartsWith((string) $vat2, '-19:-15:-9'); // Can be -19 (old version) or '-19:-15:-9' (new setup) |
|
| 1460 | + $this->assertStringStartsWith((string) $vat2, '-19:-15:-9'); // Can be -19 (old version) or '-19:-15:-9' (new setup) |
|
| 1461 | 1461 | |
| 1462 | 1462 | // Test RULE ES-IT |
| 1463 | 1463 | $vat1 = get_default_localtax($companyes, $companyit, 1, 0); |
@@ -1645,48 +1645,48 @@ discard block |
||
| 1645 | 1645 | |
| 1646 | 1646 | $conf->global->MAIN_START_WEEK = 0; |
| 1647 | 1647 | |
| 1648 | - $tmp = dol_getdate(24 * 60 * 60 + 1, false, 'UTC'); // 2/1/1970 and 1 second = friday |
|
| 1648 | + $tmp = dol_getdate(24 * 60 * 60 + 1, false, 'UTC'); // 2/1/1970 and 1 second = friday |
|
| 1649 | 1649 | $this->assertEquals(5, $tmp['wday'], 'Bad value of day in week'); |
| 1650 | 1650 | |
| 1651 | 1651 | $conf->global->MAIN_START_WEEK = 1; |
| 1652 | 1652 | |
| 1653 | - $tmp = dol_getdate(1, false, 'UTC'); // 1/1/1970 and 1 second = thirday |
|
| 1653 | + $tmp = dol_getdate(1, false, 'UTC'); // 1/1/1970 and 1 second = thirday |
|
| 1654 | 1654 | $this->assertEquals(4, $tmp['wday'], 'Bad value of day in week'); |
| 1655 | 1655 | |
| 1656 | - $tmp = dol_getdate(24 * 60 * 60 + 1, false, 'UTC'); // 2/1/1970 and 1 second = friday |
|
| 1656 | + $tmp = dol_getdate(24 * 60 * 60 + 1, false, 'UTC'); // 2/1/1970 and 1 second = friday |
|
| 1657 | 1657 | $this->assertEquals(5, $tmp['wday'], 'Bad value of day in week'); |
| 1658 | 1658 | |
| 1659 | - $tmp = dol_getdate(1, false, "Europe/Paris"); // 1/1/1970 and 1 second = thirday |
|
| 1659 | + $tmp = dol_getdate(1, false, "Europe/Paris"); // 1/1/1970 and 1 second = thirday |
|
| 1660 | 1660 | $this->assertEquals(1970, $tmp['year']); |
| 1661 | 1661 | $this->assertEquals(1, $tmp['mon']); |
| 1662 | 1662 | $this->assertEquals(1, $tmp['mday']); |
| 1663 | 1663 | $this->assertEquals(4, $tmp['wday']); |
| 1664 | 1664 | $this->assertEquals(0, $tmp['yday']); |
| 1665 | - $this->assertEquals(1, $tmp['hours']); // We are winter, so we are GMT+1 even during summer |
|
| 1665 | + $this->assertEquals(1, $tmp['hours']); // We are winter, so we are GMT+1 even during summer |
|
| 1666 | 1666 | $this->assertEquals(0, $tmp['minutes']); |
| 1667 | 1667 | $this->assertEquals(1, $tmp['seconds']); |
| 1668 | 1668 | |
| 1669 | - $tmp = dol_getdate(15638401, false, "Europe/Paris"); // 1/7/1970 and 1 second = wednesday |
|
| 1669 | + $tmp = dol_getdate(15638401, false, "Europe/Paris"); // 1/7/1970 and 1 second = wednesday |
|
| 1670 | 1670 | $this->assertEquals(1970, $tmp['year']); |
| 1671 | 1671 | $this->assertEquals(7, $tmp['mon']); |
| 1672 | 1672 | $this->assertEquals(1, $tmp['mday']); |
| 1673 | 1673 | $this->assertEquals(3, $tmp['wday']); |
| 1674 | 1674 | $this->assertEquals(181, $tmp['yday']); |
| 1675 | - $this->assertEquals(1, $tmp['hours']); // There is no daylight in 1970, so we are GMT+1 even during summer |
|
| 1675 | + $this->assertEquals(1, $tmp['hours']); // There is no daylight in 1970, so we are GMT+1 even during summer |
|
| 1676 | 1676 | $this->assertEquals(0, $tmp['minutes']); |
| 1677 | 1677 | $this->assertEquals(1, $tmp['seconds']); |
| 1678 | 1678 | |
| 1679 | - $tmp = dol_getdate(1593561601, false, "Europe/Paris"); // 1/7/2020 and 1 second = wednesday |
|
| 1679 | + $tmp = dol_getdate(1593561601, false, "Europe/Paris"); // 1/7/2020 and 1 second = wednesday |
|
| 1680 | 1680 | $this->assertEquals(2020, $tmp['year']); |
| 1681 | 1681 | $this->assertEquals(7, $tmp['mon']); |
| 1682 | 1682 | $this->assertEquals(1, $tmp['mday']); |
| 1683 | 1683 | $this->assertEquals(3, $tmp['wday']); |
| 1684 | - $this->assertEquals(182, $tmp['yday']); // 182 and not 181, due to the 29th february |
|
| 1685 | - $this->assertEquals(2, $tmp['hours']); // There is a daylight, so we are GMT+2 |
|
| 1684 | + $this->assertEquals(182, $tmp['yday']); // 182 and not 181, due to the 29th february |
|
| 1685 | + $this->assertEquals(2, $tmp['hours']); // There is a daylight, so we are GMT+2 |
|
| 1686 | 1686 | $this->assertEquals(0, $tmp['minutes']); |
| 1687 | 1687 | $this->assertEquals(1, $tmp['seconds']); |
| 1688 | 1688 | |
| 1689 | - $tmp = dol_getdate(1, false, 'UTC'); // 1/1/1970 and 1 second = thirday |
|
| 1689 | + $tmp = dol_getdate(1, false, 'UTC'); // 1/1/1970 and 1 second = thirday |
|
| 1690 | 1690 | $this->assertEquals(1970, $tmp['year']); |
| 1691 | 1691 | $this->assertEquals(1, $tmp['mon']); |
| 1692 | 1692 | $this->assertEquals(1, $tmp['mday']); |
@@ -1697,7 +1697,7 @@ discard block |
||
| 1697 | 1697 | $this->assertEquals(0, $tmp['minutes']); |
| 1698 | 1698 | $this->assertEquals(1, $tmp['seconds']); |
| 1699 | 1699 | |
| 1700 | - $tmp = dol_getdate(15638401, false, 'UTC'); // 1/7/1970 and 1 second = wednesday |
|
| 1700 | + $tmp = dol_getdate(15638401, false, 'UTC'); // 1/7/1970 and 1 second = wednesday |
|
| 1701 | 1701 | $this->assertEquals(1970, $tmp['year']); |
| 1702 | 1702 | $this->assertEquals(7, $tmp['mon']); |
| 1703 | 1703 | $this->assertEquals(1, $tmp['mday']); |
@@ -1708,12 +1708,12 @@ discard block |
||
| 1708 | 1708 | $this->assertEquals(0, $tmp['minutes']); |
| 1709 | 1709 | $this->assertEquals(1, $tmp['seconds']); |
| 1710 | 1710 | |
| 1711 | - $tmp = dol_getdate(1593561601, false, 'UTC'); // 1/7/2020 and 1 second = wednesday |
|
| 1711 | + $tmp = dol_getdate(1593561601, false, 'UTC'); // 1/7/2020 and 1 second = wednesday |
|
| 1712 | 1712 | $this->assertEquals(2020, $tmp['year']); |
| 1713 | 1713 | $this->assertEquals(7, $tmp['mon']); |
| 1714 | 1714 | $this->assertEquals(1, $tmp['mday']); |
| 1715 | 1715 | $this->assertEquals(3, $tmp['wday']); |
| 1716 | - $this->assertEquals(182, $tmp['yday']); // 182 and not 181, due to the 29th february |
|
| 1716 | + $this->assertEquals(182, $tmp['yday']); // 182 and not 181, due to the 29th february |
|
| 1717 | 1717 | // We must disable this because on CI, timezone is may be UTC or something else |
| 1718 | 1718 | //$this->assertEquals(2, $tmp['hours']); // There is a daylight, so we are GMT+2 |
| 1719 | 1719 | $this->assertEquals(0, $tmp['minutes']); |