@@ -121,7 +121,7 @@ discard block  | 
                                                    ||
| 121 | 121 | $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);  | 
                                                        
| 122 | 122 | $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);  | 
                                                        
| 123 | 123 | |
| 124 | -$pastmonth = null; // Initialise for static analysis (could be really unseg)  | 
                                                        |
| 124 | +$pastmonth = null; // Initialise for static analysis (could be really unseg)  | 
                                                        |
| 125 | 125 | $pastmonthyear = null;  | 
                                                        
| 126 | 126 | |
| 127 | 127 |  if (empty($date_startmonth)) { | 
                                                        
@@ -171,7 +171,7 @@ discard block  | 
                                                    ||
| 171 | 171 | $sql .= " LEFT JOIN ".$db->prefix()."bank_url as bu4 ON bu4.fk_bank = b.rowid AND bu4.type='payment_supplier'";  | 
                                                        
| 172 | 172 | $sql .= " LEFT JOIN ".$db->prefix()."societe as soc on bu1.url_id=soc.rowid";  | 
                                                        
| 173 | 173 |  if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { | 
                                                        
| 174 | - $sql .= " LEFT JOIN " . $db->prefix() . "societe_perentity as spe ON spe.fk_soc = soc.rowid AND spe.entity = " . ((int) $conf->entity);  | 
                                                        |
| 174 | + $sql .= " LEFT JOIN ".$db->prefix()."societe_perentity as spe ON spe.fk_soc = soc.rowid AND spe.entity = ".((int) $conf->entity);  | 
                                                        |
| 175 | 175 | }  | 
                                                        
| 176 | 176 | $sql .= " LEFT JOIN ".$db->prefix()."user as u on bu2.url_id=u.rowid";  | 
                                                        
| 177 | 177 | $sql .= " WHERE ba.fk_accountancy_journal=".((int) $id_journal);  | 
                                                        
@@ -385,7 +385,7 @@ discard block  | 
                                                    ||
| 385 | 385 | // in case option FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS is on, payment could be for more than one third-partie  | 
                                                        
| 386 | 386 | // so we have to find which part of the payment is affected to each third-parties  | 
                                                        
| 387 | 387 | // (because in this case $obj-amount = the total of the paiement and not the paiement for each third-parties)  | 
                                                        
| 388 | -		if (getDolGlobalString('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS') && ($lineisapurchase == 1 || $lineisasale == 1) ) { | 
                                                        |
| 388 | +		if (getDolGlobalString('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS') && ($lineisapurchase == 1 || $lineisasale == 1)) { | 
                                                        |
| 389 | 389 |  			if ($lineisapurchase == 1) { | 
                                                        
| 390 | 390 | $sqlamount = "SELECT SUM(pf.amount) as amount";  | 
                                                        
| 391 | 391 | $sqlamount .= " FROM ".MAIN_DB_PREFIX."paiementfounr_facturefourn AS pf";  | 
                                                        
@@ -478,7 +478,7 @@ discard block  | 
                                                    ||
| 478 | 478 | // we will pass here n times for each payment line  | 
                                                        
| 479 | 479 | // so we have to add $amoutouse only if the line $links[$key] correspond to the payment line we are in used ( socid correspondinf at the payment line $links)  | 
                                                        
| 480 | 480 | // if FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS is off we add $amounttouse  | 
                                                        
| 481 | -						if (!getDolGlobalString('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS') || $obj->socid == $links[$key]['url_id']){ | 
                                                        |
| 481 | +						if (!getDolGlobalString('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS') || $obj->socid == $links[$key]['url_id']) { | 
                                                        |
| 482 | 482 |  							if (empty($tabtp[$obj->rowid][$compta_soc])) { | 
                                                        
| 483 | 483 | $tabtp[$obj->rowid][$compta_soc] = $amounttouse;  | 
                                                        
| 484 | 484 |  							} else { | 
                                                        
@@ -753,7 +753,7 @@ discard block  | 
                                                    ||
| 753 | 753 |  				if ($mt) { | 
                                                        
| 754 | 754 |  					if (empty($conf->cache['accountingaccountincurrententity'][$k])) { | 
                                                        
| 755 | 755 | $accountingaccount = new AccountingAccount($db);  | 
                                                        
| 756 | - $accountingaccount->fetch(0, $k, true); // $k is accounting account of the bank.  | 
                                                        |
| 756 | + $accountingaccount->fetch(0, $k, true); // $k is accounting account of the bank.  | 
                                                        |
| 757 | 757 | $conf->cache['accountingaccountincurrententity'][$k] = $accountingaccount;  | 
                                                        
| 758 | 758 |  					} else { | 
                                                        
| 759 | 759 | $accountingaccount = $conf->cache['accountingaccountincurrententity'][$k];  | 
                                                        
@@ -874,43 +874,43 @@ discard block  | 
                                                    ||
| 874 | 874 |  						} elseif (in_array($tabtype[$key], array('sc', 'payment_sc'))) {   // If payment is payment of social contribution | 
                                                        
| 875 | 875 | $bookkeeping->subledger_account = '';  | 
                                                        
| 876 | 876 | $bookkeeping->subledger_label = '';  | 
                                                        
| 877 | - $accountingaccount->fetch(0, $k, true); // TODO Use a cache  | 
                                                        |
| 877 | + $accountingaccount->fetch(0, $k, true); // TODO Use a cache  | 
                                                        |
| 878 | 878 | $bookkeeping->numero_compte = $k;  | 
                                                        
| 879 | 879 | $bookkeeping->label_compte = $accountingaccount->label;  | 
                                                        
| 880 | 880 |  						} elseif ($tabtype[$key] == 'payment_vat') { | 
                                                        
| 881 | 881 | $bookkeeping->subledger_account = '';  | 
                                                        
| 882 | 882 | $bookkeeping->subledger_label = '';  | 
                                                        
| 883 | - $accountingaccount->fetch(0, $k, true); // TODO Use a cache  | 
                                                        |
| 883 | + $accountingaccount->fetch(0, $k, true); // TODO Use a cache  | 
                                                        |
| 884 | 884 | $bookkeeping->numero_compte = $k;  | 
                                                        
| 885 | 885 | $bookkeeping->label_compte = $accountingaccount->label;  | 
                                                        
| 886 | 886 |  						} elseif ($tabtype[$key] == 'payment_donation') { | 
                                                        
| 887 | 887 | $bookkeeping->subledger_account = '';  | 
                                                        
| 888 | 888 | $bookkeeping->subledger_label = '';  | 
                                                        
| 889 | - $accountingaccount->fetch(0, $k, true); // TODO Use a cache  | 
                                                        |
| 889 | + $accountingaccount->fetch(0, $k, true); // TODO Use a cache  | 
                                                        |
| 890 | 890 | $bookkeeping->numero_compte = $k;  | 
                                                        
| 891 | 891 | $bookkeeping->label_compte = $accountingaccount->label;  | 
                                                        
| 892 | 892 |  						} elseif ($tabtype[$key] == 'member') { | 
                                                        
| 893 | 893 | $bookkeeping->subledger_account = '';  | 
                                                        
| 894 | 894 | $bookkeeping->subledger_label = '';  | 
                                                        
| 895 | - $accountingaccount->fetch(0, $k, true); // TODO Use a cache  | 
                                                        |
| 895 | + $accountingaccount->fetch(0, $k, true); // TODO Use a cache  | 
                                                        |
| 896 | 896 | $bookkeeping->numero_compte = $k;  | 
                                                        
| 897 | 897 | $bookkeeping->label_compte = $accountingaccount->label;  | 
                                                        
| 898 | 898 |  						} elseif ($tabtype[$key] == 'payment_loan') { | 
                                                        
| 899 | 899 | $bookkeeping->subledger_account = '';  | 
                                                        
| 900 | 900 | $bookkeeping->subledger_label = '';  | 
                                                        
| 901 | - $accountingaccount->fetch(0, $k, true); // TODO Use a cache  | 
                                                        |
| 901 | + $accountingaccount->fetch(0, $k, true); // TODO Use a cache  | 
                                                        |
| 902 | 902 | $bookkeeping->numero_compte = $k;  | 
                                                        
| 903 | 903 | $bookkeeping->label_compte = $accountingaccount->label;  | 
                                                        
| 904 | 904 |  						} elseif ($tabtype[$key] == 'payment_various') { | 
                                                        
| 905 | 905 | $bookkeeping->subledger_account = $k;  | 
                                                        
| 906 | 906 | $bookkeeping->subledger_label = $tabcompany[$key]['name'];  | 
                                                        
| 907 | - $accountingaccount->fetch(0, $tabpay[$key]["account_various"], true); // TODO Use a cache  | 
                                                        |
| 907 | + $accountingaccount->fetch(0, $tabpay[$key]["account_various"], true); // TODO Use a cache  | 
                                                        |
| 908 | 908 | $bookkeeping->numero_compte = $tabpay[$key]["account_various"];  | 
                                                        
| 909 | 909 | $bookkeeping->label_compte = $accountingaccount->label;  | 
                                                        
| 910 | 910 |  						} elseif ($tabtype[$key] == 'banktransfert') { | 
                                                        
| 911 | 911 | $bookkeeping->subledger_account = '';  | 
                                                        
| 912 | 912 | $bookkeeping->subledger_label = '';  | 
                                                        
| 913 | - $accountingaccount->fetch(0, $k, true); // TODO Use a cache  | 
                                                        |
| 913 | + $accountingaccount->fetch(0, $k, true); // TODO Use a cache  | 
                                                        |
| 914 | 914 | $bookkeeping->numero_compte = $k;  | 
                                                        
| 915 | 915 | $bookkeeping->label_compte = $accountingaccount->label;  | 
                                                        
| 916 | 916 |  						} else { | 
                                                        
@@ -941,7 +941,7 @@ discard block  | 
                                                    ||
| 941 | 941 | }  | 
                                                        
| 942 | 942 |  						} else { | 
                                                        
| 943 | 943 |  							if ($lettering && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) { | 
                                                        
| 944 | - require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';  | 
                                                        |
| 944 | + require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';  | 
                                                        |
| 945 | 945 | $lettering_static = new Lettering($db);  | 
                                                        
| 946 | 946 | $nb_lettering = $lettering_static->bookkeepingLetteringAll(array($bookkeeping->id));  | 
                                                        
| 947 | 947 | }  | 
                                                        
@@ -1202,7 +1202,7 @@ discard block  | 
                                                    ||
| 1202 | 1202 |  		1 => $langs->trans("TransfertAllBankLines"), | 
                                                        
| 1203 | 1203 |  		2 => $langs->trans("TransfertOnlyConciliatedBankLine") | 
                                                        
| 1204 | 1204 | );  | 
                                                        
| 1205 | -	$moreoptions = [ "BankLineConciliated" => $form->selectarray('only_rappro', $listofchoices, $only_rappro, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75 valignmiddle')]; | 
                                                        |
| 1205 | +	$moreoptions = ["BankLineConciliated" => $form->selectarray('only_rappro', $listofchoices, $only_rappro, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75 valignmiddle')]; | 
                                                        |
| 1206 | 1206 | |
| 1207 | 1207 |  	journalHead($nom, '', $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink, $moreoptions); | 
                                                        
| 1208 | 1208 | |
@@ -1362,7 +1362,7 @@ discard block  | 
                                                    ||
| 1362 | 1362 | |
| 1363 | 1363 | // Label operation  | 
                                                        
| 1364 | 1364 | print '<td class="maxwidth300 nopaddingtopimp nopaddingbottomimp">';  | 
                                                        
| 1365 | - print $reflabel; // This is already html escaped content  | 
                                                        |
| 1365 | + print $reflabel; // This is already html escaped content  | 
                                                        |
| 1366 | 1366 | print "</td>";  | 
                                                        
| 1367 | 1367 | |
| 1368 | 1368 | print '<td class="center">'.$val["type_payment"]."</td>";  | 
                                                        
@@ -1456,7 +1456,7 @@ discard block  | 
                                                    ||
| 1456 | 1456 | }  | 
                                                        
| 1457 | 1457 | }  | 
                                                        
| 1458 | 1458 | print '<td class="maxwidth300" title="'.dol_escape_htmltag(dol_string_nohtmltag($accounttoshow)).'">';  | 
                                                        
| 1459 | - print $accounttoshow; // This is a HTML string  | 
                                                        |
| 1459 | + print $accounttoshow; // This is a HTML string  | 
                                                        |
| 1460 | 1460 | print "</td>";  | 
                                                        
| 1461 | 1461 | |
| 1462 | 1462 | // Subledger account  | 
                                                        
@@ -1484,12 +1484,12 @@ discard block  | 
                                                    ||
| 1484 | 1484 | }  | 
                                                        
| 1485 | 1485 | }  | 
                                                        
| 1486 | 1486 | print '<td class="maxwidth300 nopaddingtopimp nopaddingbottomimp" title="'.dolPrintHTMLForAttribute(dol_string_nohtmltag($accounttoshowsubledger)).'">';  | 
                                                        
| 1487 | - print $accounttoshowsubledger; // This is a html string  | 
                                                        |
| 1487 | + print $accounttoshowsubledger; // This is a html string  | 
                                                        |
| 1488 | 1488 | print "</td>";  | 
                                                        
| 1489 | 1489 | |
| 1490 | 1490 | // Label operation  | 
                                                        
| 1491 | 1491 | print '<td class="nopaddingtopimpo paddingbottomimp">';  | 
                                                        
| 1492 | - print $reflabel; // This is a html string  | 
                                                        |
| 1492 | + print $reflabel; // This is a html string  | 
                                                        |
| 1493 | 1493 | print "</td>";  | 
                                                        
| 1494 | 1494 | |
| 1495 | 1495 | print '<td class="center">'.$val["type_payment"]."</td>";  | 
                                                        
@@ -404,7 +404,9 @@  | 
                                                    ||
| 404 | 404 | $resultamount = $db->query($sqlamount);  | 
                                                        
| 405 | 405 |  			if ($resultamount) { | 
                                                        
| 406 | 406 | $objamount = $db->fetch_object($resultamount);  | 
                                                        
| 407 | - if (!empty($objamount->amount)) $amounttouse = $objamount->amount;  | 
                                                        |
| 407 | +				if (!empty($objamount->amount)) { | 
                                                        |
| 408 | + $amounttouse = $objamount->amount;  | 
                                                        |
| 409 | + }  | 
                                                        |
| 408 | 410 | }  | 
                                                        
| 409 | 411 | }  | 
                                                        
| 410 | 412 | |
@@ -160,7 +160,7 @@  | 
                                                    ||
| 160 | 160 | }  | 
                                                        
| 161 | 161 | require_once $classfile;  | 
                                                        
| 162 | 162 | $classname = 'printing_'.$driver;  | 
                                                        
| 163 | - $printer = new $classname($db); // Example: new printing_printgcp(). This run the construct that load the token. TODO Move this into another load function().  | 
                                                        |
| 163 | + $printer = new $classname($db); // Example: new printing_printgcp(). This run the construct that load the token. TODO Move this into another load function().  | 
                                                        |
| 164 | 164 | |
| 165 | 165 | $i = 0;  | 
                                                        
| 166 | 166 | $submit_enabled = 0;  | 
                                                        
@@ -65,7 +65,7 @@ discard block  | 
                                                    ||
| 65 | 65 | public $date_creation;  | 
                                                        
| 66 | 66 | public $date_modification;  | 
                                                        
| 67 | 67 | |
| 68 | - public $userid; // ID of user for user specific OAuth entries  | 
                                                        |
| 68 | + public $userid; // ID of user for user specific OAuth entries  | 
                                                        |
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | /**  | 
                                                        
@@ -132,7 +132,7 @@ discard block  | 
                                                    ||
| 132 | 132 | $sql .= " WHERE service = '".$this->db->escape($servicepluskeyforprovider)."'";  | 
                                                        
| 133 | 133 |  		$sql .= " AND entity IN (".getEntity('oauth_token').")"; | 
                                                        
| 134 | 134 | $resql = $this->db->query($sql);  | 
                                                        
| 135 | -		if (! $resql) { | 
                                                        |
| 135 | +		if (!$resql) { | 
                                                        |
| 136 | 136 | dol_print_error($this->db);  | 
                                                        
| 137 | 137 | }  | 
                                                        
| 138 | 138 | $obj = $this->db->fetch_array($resql);  | 
                                                        
@@ -186,7 +186,7 @@ discard block  | 
                                                    ||
| 186 | 186 |  		$sql .= " AND entity IN (".getEntity('oauth_token').")"; | 
                                                        
| 187 | 187 | |
| 188 | 188 | $resql = $this->db->query($sql);  | 
                                                        
| 189 | -		if (! $resql) { | 
                                                        |
| 189 | +		if (!$resql) { | 
                                                        |
| 190 | 190 | dol_print_error($this->db);  | 
                                                        
| 191 | 191 | }  | 
                                                        
| 192 | 192 | $result = $this->db->fetch_array($resql);  | 
                                                        
@@ -304,7 +304,7 @@ discard block  | 
                                                    ||
| 304 | 304 | $sql .= " WHERE service = '".$this->db->escape($servicepluskeyforprovider)."'";  | 
                                                        
| 305 | 305 |  		$sql .= " AND entity IN (".getEntity('oauth_token').")"; | 
                                                        
| 306 | 306 | $resql = $this->db->query($sql);  | 
                                                        
| 307 | -		if (! $resql) { | 
                                                        |
| 307 | +		if (!$resql) { | 
                                                        |
| 308 | 308 | dol_print_error($this->db);  | 
                                                        
| 309 | 309 | }  | 
                                                        
| 310 | 310 | $obj = $this->db->fetch_array($resql);  |