Merge pull request #13596 from Dolibarr/scrutinizer-patch-5

Scrutinizer Auto-Fixes
This commit is contained in:
Laurent Destailleur 2020-04-13 13:25:37 +02:00 committed by GitHub
commit dbfe68dca8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 28 additions and 28 deletions

View File

@ -37,7 +37,7 @@ $langs->loadLangs(array("users", "admin", "other"));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;

View File

@ -544,7 +544,7 @@ class Categorie extends CommonObject
} }
$sql .= ", visible = '".$this->db->escape($this->visible)."'"; $sql .= ", visible = '".$this->db->escape($this->visible)."'";
$sql .= ", fk_parent = ".$this->fk_parent; $sql .= ", fk_parent = ".$this->fk_parent;
$sql .= ", fk_user_modif = ". (int) $user->id; $sql .= ", fk_user_modif = ".(int) $user->id;
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG); dol_syslog(get_class($this)."::update", LOG_DEBUG);

View File

@ -921,7 +921,7 @@ class ActionComm extends CommonObject
$res = $this->db->query($sql); $res = $this->db->query($sql);
if (!$res) { if (!$res) {
$this->error=$this->db->lasterror(); $this->error = $this->db->lasterror();
$error++; $error++;
} }
} }

View File

@ -243,7 +243,7 @@ class Account extends CommonObject
/** /**
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/ */
public $fields=array( public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'ref' =>array('type'=>'varchar(12)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>25), 'ref' =>array('type'=>'varchar(12)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>25),
'label' =>array('type'=>'varchar(30)', 'label'=>'Label', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>30), 'label' =>array('type'=>'varchar(30)', 'label'=>'Label', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>30),

View File

@ -536,13 +536,13 @@ if ($action == "order" and $placeid != 0)
} }
if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" && $linestoprint > 0) { if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" && $linestoprint > 0) {
$invoice->fetch($placeid); //Reload object before send to printer $invoice->fetch($placeid); //Reload object before send to printer
$printer->orderprinter=1; $printer->orderprinter = 1;
$ret = $printer->sendToPrinter($invoice, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION["takeposterminal"]}, $conf->global->{'TAKEPOS_ORDER_PRINTER1_TO_USE'.$_SESSION["takeposterminal"]}); // PRINT TO PRINTER 1 $ret = $printer->sendToPrinter($invoice, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION["takeposterminal"]}, $conf->global->{'TAKEPOS_ORDER_PRINTER1_TO_USE'.$_SESSION["takeposterminal"]}); // PRINT TO PRINTER 1
} }
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='1' and fk_facture=".$invoice->id; // Set as printed $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='1' and fk_facture=".$invoice->id; // Set as printed
$db->query($sql); $db->query($sql);
$invoice->fetch($placeid); //Reload object after set lines as printed $invoice->fetch($placeid); //Reload object after set lines as printed
$linestoprint=0; $linestoprint = 0;
foreach ($invoice->lines as $line) foreach ($invoice->lines as $line)
{ {
@ -564,7 +564,7 @@ if ($action == "order" and $placeid != 0)
} }
if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" && $linestoprint > 0) { if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" && $linestoprint > 0) {
$invoice->fetch($placeid); //Reload object before send to printer $invoice->fetch($placeid); //Reload object before send to printer
$printer->orderprinter=2; $printer->orderprinter = 2;
$ret = $printer->sendToPrinter($invoice, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION["takeposterminal"]}, $conf->global->{'TAKEPOS_ORDER_PRINTER2_TO_USE'.$_SESSION["takeposterminal"]}); // PRINT TO PRINTER 2 $ret = $printer->sendToPrinter($invoice, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION["takeposterminal"]}, $conf->global->{'TAKEPOS_ORDER_PRINTER2_TO_USE'.$_SESSION["takeposterminal"]}); // PRINT TO PRINTER 2
} }
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='2' and fk_facture=".$invoice->id; // Set as printed $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='2' and fk_facture=".$invoice->id; // Set as printed
@ -712,8 +712,8 @@ function TakeposPrinting(id){
function TakeposConnector(id){ function TakeposConnector(id){
var invoice='<?php var invoice='<?php
$data=json_encode($invoice); $data = json_encode($invoice);
$data=base64_encode($data); $data = base64_encode($data);
echo $data; echo $data;
?>'; ?>';
$.ajax({ $.ajax({

View File

@ -378,7 +378,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
$morehtmlright = ''; $morehtmlright = '';
if ($account->id == 0) { if ($account->id == 0) {
$morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=create'); $morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=create');
} }
print load_fiche_titre($langs->trans("BankAccounts"), $morehtmlright, 'bank_account'); print load_fiche_titre($langs->trans("BankAccounts"), $morehtmlright, 'bank_account');
@ -395,49 +395,49 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
if($account->id > 0) { if ($account->id > 0) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Label // Label
print '<td>' . $account->label . '</td>'; print '<td>'.$account->label.'</td>';
// Bank name // Bank name
print '<td>' . $account->bank . '</td>'; print '<td>'.$account->bank.'</td>';
// Account number // Account number
print '<td>'; print '<td>';
$string = ''; $string = '';
foreach ($account->getFieldsToShow() as $val) { foreach ($account->getFieldsToShow() as $val) {
if ($val == 'BankCode') { if ($val == 'BankCode') {
$string .= $account->code_banque . ' '; $string .= $account->code_banque.' ';
} elseif ($val == 'BankAccountNumber') { } elseif ($val == 'BankAccountNumber') {
$string .= $account->number . ' '; $string .= $account->number.' ';
} elseif ($val == 'DeskCode') { } elseif ($val == 'DeskCode') {
$string .= $account->code_guichet . ' '; $string .= $account->code_guichet.' ';
} elseif ($val == 'BankAccountNumberKey') { } elseif ($val == 'BankAccountNumberKey') {
$string .= $account->cle_rib . ' '; $string .= $account->cle_rib.' ';
} }
} }
if (!empty($account->label) && $account->number) { if (!empty($account->label) && $account->number) {
if (!checkBanForAccount($account)) { if (!checkBanForAccount($account)) {
$string .= ' ' . img_picto($langs->trans("ValueIsNotValid"), 'warning'); $string .= ' '.img_picto($langs->trans("ValueIsNotValid"), 'warning');
} else { } else {
$string .= ' ' . img_picto($langs->trans("ValueIsValid"), 'info'); $string .= ' '.img_picto($langs->trans("ValueIsValid"), 'info');
} }
} }
print $string; print $string;
print '</td>'; print '</td>';
// IBAN // IBAN
print '<td>' . $account->iban; print '<td>'.$account->iban;
if (!empty($account->iban)) { if (!empty($account->iban)) {
if (!checkIbanForAccount($account)) { if (!checkIbanForAccount($account)) {
print ' ' . img_picto($langs->trans("IbanNotValid"), 'warning'); print ' '.img_picto($langs->trans("IbanNotValid"), 'warning');
} }
} }
print '</td>'; print '</td>';
// BIC // BIC
print '<td>' . $account->bic; print '<td>'.$account->bic;
if (!empty($account->bic)) { if (!empty($account->bic)) {
if (!checkSwiftForAccount($account)) { if (!checkSwiftForAccount($account)) {
print ' ' . img_picto($langs->trans("SwiftNotValid"), 'warning'); print ' '.img_picto($langs->trans("SwiftNotValid"), 'warning');
} }
} }
print '</td>'; print '</td>';
@ -445,7 +445,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
// Edit/Delete // Edit/Delete
print '<td class="right nowraponall">'; print '<td class="right nowraponall">';
if ($user->rights->hrm->employee->write || $user->rights->user->creer) { if ($user->rights->hrm->employee->write || $user->rights->user->creer) {
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&bankid=' . $account->id . '&action=edit">'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&bankid='.$account->id.'&action=edit">';
print img_picto($langs->trans("Modify"), 'edit'); print img_picto($langs->trans("Modify"), 'edit');
print '</a>'; print '</a>';
} }

View File

@ -360,7 +360,7 @@ if ($action == 'unsetshowsubcontainers')
exit; exit;
} }
if (($action == 'replacesite' || $action == 'replacesiteconfirm') && ! $searchkey) if (($action == 'replacesite' || $action == 'replacesiteconfirm') && !$searchkey)
{ {
$action = 'replacesite'; $action = 'replacesite';
} }
@ -373,13 +373,13 @@ if ($massaction == 'replace' && GETPOST('confirmmassaction', 'alpha'))
if (empty($user->rights->website->writephp)) { if (empty($user->rights->website->writephp)) {
setEventMessages("NotAllowedToAddDynamicContent", null, 'errors'); setEventMessages("NotAllowedToAddDynamicContent", null, 'errors');
} }
elseif (! $replacestring) { elseif (!$replacestring) {
setEventMessages("ErrorReplaceStringEmpty", null, 'errors'); setEventMessages("ErrorReplaceStringEmpty", null, 'errors');
} }
else { else {
$nbreplacement = 0; $nbreplacement = 0;
foreach($toselect as $keyselected) { foreach ($toselect as $keyselected) {
$objectpage = $listofpages['list'][$keyselected]; $objectpage = $listofpages['list'][$keyselected];
if ($objectpage->pageurl) { if ($objectpage->pageurl) {
dol_syslog("Replace string into page ".$objectpage->pageurl); dol_syslog("Replace string into page ".$objectpage->pageurl);
@ -3543,7 +3543,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
$massactionbutton .= '<div class="massactionother hidden">'; $massactionbutton .= '<div class="massactionother hidden">';
$massactionbutton .= $langs->trans("ReplaceString"); $massactionbutton .= $langs->trans("ReplaceString");
$massactionbutton .= '<input type="text" name="replacestring" value="'.dol_escape_htmltag(GETPOST('replacestring', 'none')).'">'; $massactionbutton .= '<input type="text" name="replacestring" value="'.dol_escape_htmltag(GETPOST('replacestring', 'none')).'">';
$massactionbutton .='</div>'; $massactionbutton .= '</div>';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
//$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields //$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields