diff --git a/dev/initdemo/sftpget_and_loaddump.php b/dev/initdemo/sftpget_and_loaddump.php index e9641ac6816..e261895b617 100755 --- a/dev/initdemo/sftpget_and_loaddump.php +++ b/dev/initdemo/sftpget_and_loaddump.php @@ -48,7 +48,7 @@ if (! $res && file_exists("../../master.inc.php")) $res=@include "../../master.i if (! $res && file_exists("../../../master.inc.php")) $res=@include "../../../master.inc.php"; if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only -if (! $res) die ("Failed to include master.inc.php file\n"); +if (! $res) die("Failed to include master.inc.php file\n"); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; diff --git a/dev/initdemo/updatedemo.php b/dev/initdemo/updatedemo.php index 606bdbe6f56..53ae2251f35 100755 --- a/dev/initdemo/updatedemo.php +++ b/dev/initdemo/updatedemo.php @@ -43,7 +43,7 @@ if (! $res && file_exists("../../master.inc.php")) $res=@include "../../master.i if (! $res && file_exists("../../../master.inc.php")) $res=@include "../../../master.inc.php"; if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only -if (! $res) die ("Failed to include master.inc.php file\n"); +if (! $res) die("Failed to include master.inc.php file\n"); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 6098a0e0139..296c6cb9b6f 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -428,5 +428,6 @@ - + + diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index 67ae907d9a4..bf2b8d4f948 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -173,17 +173,16 @@ while ($obj = $db->fetch_object($resql)) { $sql.= $db->plimit($limit+1, $offset); -dol_syslog ("/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG); +dol_syslog("/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG); $resql = $db->query($sql); -if (! $resql) -{ +if (! $resql) { dol_print_error($db); exit; } $num = $db->num_rows($resql); -dol_syslog ("/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG); +dol_syslog("/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index c6434da6388..6bbc4ad9c62 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -633,12 +633,12 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"' . $key . '"' . $sep; print '"' . $date . '"' . $sep; print '"' . $val["refsologest"] . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 32)). '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 32)). '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . $langs->trans("Thirdparty") . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Thirdparty") . '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Thirdparty") . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep; print '"' . $journal . '"' ; @@ -654,12 +654,12 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"' . $key . '"' . $sep; print '"' . $date . '"' . $sep; print '"' . $val["refsologest"] . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 32)) . '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '""' . $sep; - print '"' . utf8_decode (dol_trunc($accountingaccount->label, 32)) . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; + print '"' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep; print '"' . $journal . '"' ; @@ -679,7 +679,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"' . $key . '"' . $sep; print '"' . $date . '"' . $sep; print '"' . $val["refsologest"] . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 32)) . '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '""' . $sep; @@ -700,12 +700,12 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"' . $key . '"' . $sep; print '"' . $date . '"' . $sep; print '"' . $val["refsologest"] . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 32)). '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 32)). '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . $langs->trans("Thirdparty") . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . ' NPR"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . ' NPR"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep; print '"' . $journal . '"' ; diff --git a/htdocs/cashdesk/facturation_verif.php b/htdocs/cashdesk/facturation_verif.php index 3c455f102f9..a7aab12b2ef 100644 --- a/htdocs/cashdesk/facturation_verif.php +++ b/htdocs/cashdesk/facturation_verif.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $action = GETPOST('action', 'alpha'); $obj_facturation = unserialize($_SESSION['serObjFacturation']); -unset ($_SESSION['serObjFacturation']); +unset($_SESSION['serObjFacturation']); switch($action) diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index b75878b11bd..9d47c63a75a 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -359,7 +359,7 @@ switch ($action) // End of case: valide_facture } -unset ($_SESSION['serObjFacturation']); +unset($_SESSION['serObjFacturation']); $_SESSION['serObjFacturation'] = serialize($obj_facturation); diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index f5b13437ba9..2b670ae5286 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -220,7 +220,7 @@ class Categories extends DolibarrApi if ($this->category->update(DolibarrApiAccess::$user) > 0) { - return $this->get ($id); + return $this->get($id); } else { diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 20d9a862f33..99433a9b8f0 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1472,8 +1472,7 @@ class Categorie extends CommonObject // We want to reverse lookup $map_type = array_flip($this->MAP_ID); $type = $map_type[$type]; -dol_syslog( get_class($this) . "::rechercher(): numeric types are deprecated, please use string instead", - LOG_WARNING ); + dol_syslog(get_class($this) . "::rechercher(): numeric types are deprecated, please use string instead", LOG_WARNING); } // Generation requete recherche diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 00aae3a8b08..567f968e3d2 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -423,12 +423,15 @@ class AdvanceTargetingMailing extends CommonObject $this->db->begin(); dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (! $resql) { + $error++; + $this->errors[]="Error ".$this->db->lasterror(); + } - if (! $error) - { - if (! $notrigger) - { + //if (! $error) + //{ + // if (! $notrigger) + // { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -438,8 +441,8 @@ class AdvanceTargetingMailing extends CommonObject //$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers - } - } + // } + //} // Commit or rollback if ($error) @@ -790,15 +793,15 @@ class AdvanceTargetingMailing extends CommonObject if (!empty($arrayquery['options_'.$key.'_end_dt'.'_cnct'])){ $sqlwhere[]= " (te.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'.'_cnct'])."' AND te.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt'.'_cnct'])."')"; } - }elseif ($extrafields->attribute_type[$key] == 'boolean') { + } elseif ($extrafields->attribute_type[$key] == 'boolean') { if ($arrayquery['options_'.$key.'_cnct']!=''){ if ($arrayquery['options_'.$key.'_cnct']==0) { $sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key.'_cnct']." OR ((te.".$key." IS NULL) AND (te.fk_object IS NOT NULL)))"; - }else { + } else { $sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key.'_cnct'].")"; } } - }else{ + } else { if (is_array($arrayquery['options_'.$key.'_cnct'])) { $sqlwhere[]= " (te.".$key." IN ('".implode("','", $arrayquery['options_'.$key.'_cnct'])."'))"; } elseif (!empty($arrayquery['options_'.$key.'_cnct'])) { @@ -965,12 +968,12 @@ class AdvanceTargetingMailing extends CommonObject } if (count($return_sql_like)>0) { - $return_sql_criteria .= '(' . implode (' OR ', $return_sql_like) .')'; + $return_sql_criteria .= '(' . implode(' OR ', $return_sql_like) .')'; } if (count($return_sql_not_like)>0) { - $return_sql_criteria .= ' AND (' . implode (' AND ', $return_sql_not_like).')'; + $return_sql_criteria .= ' AND (' . implode(' AND ', $return_sql_not_like).')'; } - }else { + } else { $return_sql_criteria .= $column_to_test . ' LIKE \''.$this->db->escape($criteria).'\''; } diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 26b16e50d68..66303647dbc 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2014 Florian Henry + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,10 +44,10 @@ class FormAdvTargetEmailing extends Form */ function __construct($db) { - global $langs; + global $langs; - $this->db = $db; - } + $this->db = $db; + } /** * Affiche un champs select contenant une liste @@ -64,7 +65,7 @@ class FormAdvTargetEmailing extends Form $sql .= " FROM " . MAIN_DB_PREFIX . "c_prospectlevel"; $sql .= " WHERE active > 0"; $sql .= " ORDER BY sortorder"; - dol_syslog (get_class($this) . '::multiselectProspectionStatus sql=' . $sql, LOG_DEBUG); + dol_syslog(get_class($this) . '::multiselectProspectionStatus sql=' . $sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -83,7 +84,7 @@ class FormAdvTargetEmailing extends Form dol_print_error($this->db); } return $this->advMultiselectarray($htmlname, $options_array, $selected_array); - } + } /** * Return combo list of activated countries, into language of user @@ -120,10 +121,10 @@ class FormAdvTargetEmailing extends Form $foundselected = false; while ($i < $num) { - $obj = $this->db->fetch_object ($resql); + $obj = $this->db->fetch_object($resql); $countryArray [$i] ['rowid'] = $obj->rowid; $countryArray [$i] ['code_iso'] = $obj->code_iso; - $countryArray [$i] ['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv ("Country" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); + $countryArray [$i] ['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv("Country" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); $label[$i] = $countryArray[$i]['label']; $i ++; } @@ -143,7 +144,7 @@ class FormAdvTargetEmailing extends Form } return $this->advMultiselectarray($htmlname, $options_array, $selected_array); - } + } /** * Return select list for categories (to use in form search selectors) @@ -166,26 +167,26 @@ class FormAdvTargetEmailing extends Form $sql_usr .= " WHERE u2.entity IN (0," . $conf->entity . ")"; $sql_usr .= " AND u2.rowid = sc.fk_user "; - if (! empty ($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) + if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) $sql_usr .= " AND u2.statut<>0 "; $sql_usr .= " ORDER BY name ASC"; // print $sql_usr;exit; - $resql_usr = $this->db->query ($sql_usr); + $resql_usr = $this->db->query($sql_usr); if ($resql_usr) { - while ( $obj_usr = $this->db->fetch_object ($resql_usr) ) { + while ( $obj_usr = $this->db->fetch_object($resql_usr) ) { $label = $obj_usr->firstname . " " . $obj_usr->name . " (" . $obj_usr->login . ')'; $options_array [$obj_usr->rowid] = $label; } - $this->db->free ($resql_usr); + $this->db->free($resql_usr); } else { - dol_print_error ($this->db); + dol_print_error($this->db); } - return $this->advMultiselectarray ($htmlname, $options_array, $selected_array); - } + return $this->advMultiselectarray($htmlname, $options_array, $selected_array); + } /** * Return select list for categories (to use in form search selectors) @@ -210,7 +211,7 @@ class FormAdvTargetEmailing extends Form } asort($options_array); return $this->advMultiselectarray($htmlname, $options_array, $selected_array); - } + } /** * Return multiselect list of entities for extrafeild type sellist @@ -227,8 +228,8 @@ class FormAdvTargetEmailing extends Form if (is_array($sqlqueryparam)) { - $param_list = array_keys ($sqlqueryparam); - $InfoFieldList = explode (":", $param_list [0]); + $param_list = array_keys($sqlqueryparam); + $InfoFieldList = explode(":", $param_list [0]); // 0 1 : tableName // 1 2 : label field name Nom du champ contenant le libelle @@ -237,8 +238,8 @@ class FormAdvTargetEmailing extends Form $keyList = 'rowid'; - if (count ($InfoFieldList) >= 3) { - if (strpos ($InfoFieldList [3], 'extra.') !== false) { + if (count($InfoFieldList) >= 3) { + if (strpos($InfoFieldList [3], 'extra.') !== false) { $keyList = 'main.' . $InfoFieldList [2] . ' as rowid'; } else { $keyList = $InfoFieldList [2] . ' as rowid'; @@ -247,10 +248,10 @@ class FormAdvTargetEmailing extends Form $sql = 'SELECT ' . $keyList . ', ' . $InfoFieldList [1]; $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList [0]; - if (! empty ($InfoFieldList [3])) { + if (! empty($InfoFieldList [3])) { // We have to join on extrafield table - if (strpos ($InfoFieldList [3], 'extra') !== false) { + if (strpos($InfoFieldList [3], 'extra') !== false) { $sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList [0] . '_extrafields as extra'; $sql .= ' WHERE extra.fk_object=main.' . $InfoFieldList [2] . ' AND ' . $InfoFieldList [3]; } else { @@ -270,13 +271,13 @@ class FormAdvTargetEmailing extends Form $i = 0; if ($num) { while ( $i < $num ) { - $obj = $this->db->fetch_object ($resql); - $labeltoshow = dol_trunc ($obj->$InfoFieldList [1], 90); + $obj = $this->db->fetch_object($resql); + $labeltoshow = dol_trunc($obj->$InfoFieldList [1], 90); $options_array[$obj->rowid]=$labeltoshow; $i ++; } } - $this->db->free ($resql); + $this->db->free($resql); } } @@ -328,7 +329,7 @@ class FormAdvTargetEmailing extends Form dol_print_error($this->db); } - return $this->advMultiselectarray ($htmlname, $options_array, $selected_array); + return $this->advMultiselectarray($htmlname, $options_array, $selected_array); } /** @@ -347,7 +348,7 @@ class FormAdvTargetEmailing extends Form $form=new Form($this->db); $return = $form->multiselectarray($htmlname, $options_array, $selected_array, 0, 0, '', 0, 295); return $return; - } + } /** * Return combo list with customer categories @@ -438,19 +439,19 @@ class FormAdvTargetEmailing extends Form $sql .= " WHERE type_element='$type_element'"; $sql .= " ORDER BY c.name"; - dol_syslog (get_class ($this) . "::".__METHOD__, LOG_DEBUG); - $resql = $this->db->query ($sql); + dol_syslog(get_class($this) . "::".__METHOD__, LOG_DEBUG); + $resql = $this->db->query($sql); if ($resql) { $out .= ''; } else { - dol_print_error ($this->db); + dol_print_error($this->db); } - $this->db->free ($resql); + $this->db->free($resql); return $out; - } + } } diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 98d7e720628..c1b483efe8c 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -570,7 +570,7 @@ abstract class CommonDocGenerator 'line_multicurrency_total_ttc_locale' => price($line->multicurrency_total_ttc, 0, $outputlangs), ); - // Units + // Units if ($conf->global->PRODUCT_USE_UNITS) { $resarray['line_unit']=$outputlangs->trans($line->getLabelOfUnit('long')); @@ -882,7 +882,7 @@ abstract class CommonDocGenerator // Sorting - uasort ($this->cols, array( $this, 'columnSort' )); + uasort($this->cols, array($this, 'columnSort')); // Positionning $curX = $this->page_largeur-$this->marge_droite; // start from right @@ -945,10 +945,10 @@ abstract class CommonDocGenerator } /** - * get column content width from column key + * get column content width from column key * - * @param string $colKey the column key - * @return float width in mm + * @param string $colKey the column key + * @return float width in mm */ function getColumnContentWidth($colKey) { @@ -1025,13 +1025,13 @@ abstract class CommonDocGenerator /** - * print standard column content + * print standard column content * - * @param PDF $pdf pdf object - * @param float $curY curent Y position - * @param string $colKey the column key - * @param string $columnText column text - * @return int new rank on success and -1 on error + * @param PDF $pdf pdf object + * @param float $curY curent Y position + * @param string $colKey the column key + * @param string $columnText column text + * @return int new rank on success and -1 on error */ function printStdColumnContent($pdf, &$curY, $colKey, $columnText = '') { diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 6ea2e01fbfc..1159c74dc8d 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -228,9 +228,9 @@ class FormMail extends Form if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';', $_SESSION["listofmimes".$keytoavoidconflict]); if ($keytodelete >= 0) { - unset ($listofpaths[$keytodelete]); - unset ($listofnames[$keytodelete]); - unset ($listofmimes[$keytodelete]); + unset($listofpaths[$keytodelete]); + unset($listofnames[$keytodelete]); + unset($listofmimes[$keytodelete]); $_SESSION["listofpaths".$keytoavoidconflict]=join(';', $listofpaths); $_SESSION["listofnames".$keytoavoidconflict]=join(';', $listofnames); $_SESSION["listofmimes".$keytoavoidconflict]=join(';', $listofmimes); diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index f59ad79c430..695464f536f 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -655,7 +655,7 @@ class SMTPs $_retVal = true; // if we have a path... - if ( ! empty ($_strConfigPath) ) + if ( ! empty($_strConfigPath) ) { // If the path is not valid, this will NOT generate an error, // it will simply return false. @@ -989,7 +989,7 @@ class SMTPs $aryHost = $this->_msgRecipients; // Only run this if we have something - if ( !empty ($_addrList)) + if ( !empty($_addrList)) { // $_addrList can be a STRING or an array if ( is_string($_addrList) ) @@ -1409,7 +1409,7 @@ class SMTPs // If we have ZERO, we have a problem if( $keyCount === 0 ) - die ("Sorry, no content"); + die("Sorry, no content"); // If we have ONE, we can use the simple format elseif( $keyCount === 1 && empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 45a8d5bd5c6..c541808399d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6610,12 +6610,12 @@ function dol_sort_array(&$array, $index, $order = 'asc', $natsort = 0, $case_sen $temp = array(); foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index]; - if (!$natsort) ($order=='asc') ? asort($temp) : arsort($temp); - else - { - ($case_sensitive) ? natsort($temp) : natcasesort($temp); - if($order!='asc') $temp=array_reverse($temp, true); - } + if (! $natsort) { + ($order=='asc') ? asort($temp) : arsort($temp); + } else { + ($case_sensitive) ? natsort($temp) : natcasesort($temp); + if($order!='asc') $temp=array_reverse($temp, true); + } $sorted = array(); diff --git a/htdocs/core/lib/functionsnumtoword.lib.php b/htdocs/core/lib/functionsnumtoword.lib.php index 7f4d44f73f6..6481604ff64 100644 --- a/htdocs/core/lib/functionsnumtoword.lib.php +++ b/htdocs/core/lib/functionsnumtoword.lib.php @@ -38,10 +38,10 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false) global $conf; $num = str_replace(array(',', ' '), '', trim($num)); - if(! $num) { + if (! $num) { return false; } - if($centimes && strlen($num) == 1) { + if ($centimes && strlen($num) == 1) { $num = $num*10; } $TNum = explode('.', $num); @@ -151,7 +151,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') if ($numero >= 1000000000001) return -1; // Get 2 decimals to cents, another functions round or truncate - $strnumber = number_format ($numero, 10); + $strnumber = number_format($numero, 10); $len=strlen($strnumber); for ($i=0; $i<$len; $i++) { @@ -187,7 +187,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') $numero = $numero - $DdMMillon * 10000000000; $UdMMillon = (int) ($numero / 1000000000); $numero = $numero - $UdMMillon * 1000000000; - $entexto .= hundreds2text ($CdMMillon, $DdMMillon, $UdMMillon); + $entexto .= hundreds2text($CdMMillon, $DdMMillon, $UdMMillon); $entexto .= " MIL "; } if ($number >= 1000000){ @@ -197,7 +197,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') $numero = $numero - $DdMILLON * 10000000; $udMILLON = (int) ($numero / 1000000); $numero = $numero - $udMILLON * 1000000; - $entexto .= hundreds2text ($CdMILLON, $DdMILLON, $udMILLON); + $entexto .= hundreds2text($CdMILLON, $DdMILLON, $udMILLON); if (!$CdMMillon && !$DdMMillon && !$UdMMillon && !$CdMILLON && !$DdMILLON && $udMILLON==1) $entexto .= " MILLÓN "; else @@ -210,7 +210,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') $numero = $numero - $ddm * 10000; $udm = (int) ($numero / 1000); $numero = $numero - $udm * 1000; - $entexto .= hundreds2text ($cdm, $ddm, $udm); + $entexto .= hundreds2text($cdm, $ddm, $udm); if ($cdm || $ddm || $udm) $entexto .= " MIL "; } @@ -218,7 +218,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') $numero = $numero - $c * 100; $d = (int) ($numero / 10); $u = (int) $numero - $d * 10; - $entexto .= hundreds2text ($c, $d, $u); + $entexto .= hundreds2text($c, $d, $u); if (!$cdm && !$ddm && !$udm && !$c && !$d && !$u && $number>1000000) $entexto .= " DE"; $entexto .= " PESOS ".$parte_decimal." / 100 M.N."; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 5a7b7ff2e42..4886d5c5086 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -121,7 +121,7 @@ if (empty($reshook)) { $action = ''; $object->fetch($id); // show shipment also after canceling modification - } + } include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once @@ -784,8 +784,7 @@ if (empty($reshook)) $stockLocation="entl".$detail_entrepot->line_id; $qty = "qtyl".$detail_entrepot->line_id; $warehouse = GETPOST($stockLocation, 'int'); - if (!empty ($warehouse)) - { + if (!empty($warehouse)) { $line->id = $detail_entrepot->line_id; $line->entrepot_id = $warehouse; $line->qty = GETPOST($qty, 'int'); @@ -800,8 +799,9 @@ if (empty($reshook)) } } } - else // Product no predefined + else { + // Product no predefined $qty = "qtyl".$line_id; $line->id = $line_id; $line->qty = GETPOST($qty, 'int'); diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 69e6ff160dc..4391d14ea3c 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -185,8 +185,8 @@ class SupplierInvoices extends DolibarrApi function post($request_data = null) { if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { - throw new RestException(401, "Insuffisant rights"); - } + throw new RestException(401, "Insuffisant rights"); + } // Check mandatory fields $result = $this->_validate($request_data); @@ -221,8 +221,8 @@ class SupplierInvoices extends DolibarrApi function put($id, $request_data = null) { if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { - throw new RestException(401); - } + throw new RestException(401); + } $result = $this->invoice->fetch($id); if( ! $result ) { @@ -239,7 +239,7 @@ class SupplierInvoices extends DolibarrApi } if($this->invoice->update($id, DolibarrApiAccess::$user)) - return $this->get ($id); + return $this->get($id); return false; } @@ -253,8 +253,8 @@ class SupplierInvoices extends DolibarrApi function delete($id) { if(! DolibarrApiAccess::$user->rights->fournisseur->facture->supprimer) { - throw new RestException(401); - } + throw new RestException(401); + } $result = $this->invoice->fetch($id); if( ! $result ) { throw new RestException(404, 'Supplier invoice not found'); @@ -306,9 +306,9 @@ class SupplierInvoices extends DolibarrApi throw new RestException(404, 'Invoice not found'); } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } $result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger); if ($result == 0) { diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index b48635d3fd1..38c9ab9e200 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -190,8 +190,8 @@ class SupplierOrders extends DolibarrApi function post($request_data = null) { if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) { - throw new RestException(401, "Insuffisant rights"); - } + throw new RestException(401, "Insuffisant rights"); + } // Check mandatory fields $result = $this->_validate($request_data); @@ -226,8 +226,8 @@ class SupplierOrders extends DolibarrApi function put($id, $request_data = null) { if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) { - throw new RestException(401); - } + throw new RestException(401); + } $result = $this->order->fetch($id); if( ! $result ) { @@ -244,7 +244,7 @@ class SupplierOrders extends DolibarrApi } if($this->order->update($id, DolibarrApiAccess::$user)) - return $this->get ($id); + return $this->get($id); return false; } @@ -257,20 +257,19 @@ class SupplierOrders extends DolibarrApi */ function delete($id) { - if(! DolibarrApiAccess::$user->rights->fournisseur->commande->supprimer) { - throw new RestException(401); - } + if (! DolibarrApiAccess::$user->rights->fournisseur->commande->supprimer) { + throw new RestException(401); + } $result = $this->order->fetch($id); - if( ! $result ) { + if ( ! $result) { throw new RestException(404, 'Supplier order not found'); } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { + if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - if( $this->order->delete(DolibarrApiAccess::$user) < 0) - { + if ( $this->order->delete(DolibarrApiAccess::$user) < 0) { throw new RestException(500); } diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index 93e3d1128e2..8840da3f3e7 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -1,6 +1,6 @@ - * Copyright (C) 2014 Marcos García +/* Copyright (C) 2013 Laurent Destailleur + * Copyright (C) 2014 Marcos García * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -448,7 +448,7 @@ if (issetAndNoEmpty('reporterhoraires')) { if (issetAndNoEmpty('resethoraires')) { $nbofchoice=count($_SESSION["totalchoixjour"]); for ($i = 0; $i < $nbofchoice; $i++) { - unset ($_SESSION["horaires$i"]); + unset($_SESSION["horaires$i"]); } } @@ -484,7 +484,8 @@ for ($i = 0; $i < $nbrejourmois + $premierjourmois; $i++) { //bouton vert if (($numerojour >= $jourAJ && $_SESSION["mois"] == $moisAJ && $_SESSION["annee"] == $anneeAJ) || ($_SESSION["mois"] > $moisAJ && $_SESSION["annee"] == $anneeAJ) || $_SESSION["annee"] > $anneeAJ) { print ''."\n"; - } else { //bouton gris + } else { + //bouton gris print ''.$numerojour.''."\n"; } } diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index 9dd34f18569..ba8339f98ed 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -205,7 +205,7 @@ class Warehouses extends DolibarrApi } if($this->warehouse->update($id, DolibarrApiAccess::$user)) - return $this->get ($id); + return $this->get($id); return false; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 4c964f591d0..ba80c61e4ca 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2010,16 +2010,16 @@ class Societe extends CommonObject $name=$this->name?$this->name:$this->nom; - if(!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)){ - if(empty($option) && $this->client > 0) $option = 'customer'; - if(empty($option) && $this->fournisseur > 0) $option = 'supplier'; + if (!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)){ + if (empty($option) && $this->client > 0) $option = 'customer'; + if (empty($option) && $this->fournisseur > 0) $option = 'supplier'; } if (! empty($conf->global->SOCIETE_ADD_REF_IN_LIST) && (!empty($withpicto))) { $code = ''; - if (($this->client) && (! empty ($this->code_client)) + if (($this->client) && (! empty($this->code_client)) && ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1 || $conf->global->SOCIETE_ADD_REF_IN_LIST == 2 ) @@ -2028,7 +2028,7 @@ class Societe extends CommonObject $code = $this->code_client . ' - '; } - if (($this->fournisseur) && (! empty ($this->code_fournisseur)) + if (($this->fournisseur) && (! empty($this->code_fournisseur)) && ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1 || $conf->global->SOCIETE_ADD_REF_IN_LIST == 3 ) diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index 50d64521621..7a3c089acf3 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -80,7 +80,7 @@ if ($facid > 0) if (! empty($conf->stripe->enabled)) { - access_forbidden(); + access_forbidden(); } if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha')) @@ -230,9 +230,9 @@ if (empty($reshook)) $action = 'create'; if (!$source) { setEventMessages($langs->transnoentities('NoSource'), null, 'errors'); - } - $error++; - } + } + $error++; + } // Le reste propre a cette action s'affiche en bas de page. } @@ -995,7 +995,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Print total print ''; print ''.$langs->trans('TotalTTC').''; - if (!empty($conf->multicurrency->enabled)) { + if (!empty($conf->multicurrency->enabled)) { print ''; print ''; print ''; @@ -1007,7 +1007,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits, 'MT')).''; print ''; - if (!empty($conf->multicurrency->enabled)) { + if (!empty($conf->multicurrency->enabled)) { print ''; } print "\n"; @@ -1018,7 +1018,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $db->free($resql); } else - { + { dol_print_error($db); } @@ -1051,9 +1051,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if (!empty($totalpayment)) { $text = $langs->trans('ConfirmCustomerPayment', $totalpayment, $langs->trans("Currency".$conf->currency)); } - if (!empty($multicurrency_totalpayment)) { - $text.='
'.$langs->trans('ConfirmCustomerPayment', $multicurrency_totalpayment, $langs->trans("paymentInInvoiceCurrency")); - } + if (!empty($multicurrency_totalpayment)) { + $text.='
'.$langs->trans('ConfirmCustomerPayment', $multicurrency_totalpayment, $langs->trans("paymentInInvoiceCurrency")); + } if (GETPOST('closepaidinvoices')) { $text.='
'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed"); diff --git a/htdocs/takepos/ajax.php b/htdocs/takepos/ajax.php index 5871d27a618..4b16cc9ec81 100644 --- a/htdocs/takepos/ajax.php +++ b/htdocs/takepos/ajax.php @@ -42,21 +42,21 @@ $term = GETPOST('term', 'alpha'); * View */ -if ($action=="getProducts"){ - $object = new Categorie($db); - $result=$object->fetch($category); - $prods = $object->getObjectsInCateg("product"); - echo json_encode($prods); +if ($action=="getProducts") { + $object = new Categorie($db); + $result=$object->fetch($category); + $prods = $object->getObjectsInCateg("product"); + echo json_encode($prods); } -if ($action=="search"){ - $sql = 'SELECT * FROM '.MAIN_DB_PREFIX.'product'; - $sql.= ' WHERE entity IN ('.getEntity('product').')'; - $sql .= natural_search(array('label','barcode'), $term); - $resql = $db->query($sql); - $rows = array(); - while($row = $db->fetch_array ($resql)){ - $rows[] = $row; - } - echo json_encode($rows); +if ($action=="search") { + $sql = 'SELECT * FROM '.MAIN_DB_PREFIX.'product'; + $sql .= ' WHERE entity IN ('.getEntity('product').')'; + $sql .= natural_search(array('label','barcode'), $term); + $resql = $db->query($sql); + $rows = array(); + while ($row = $db->fetch_array($resql)) { + $rows[] = $row; + } + echo json_encode($rows); } diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php index 7ca0a40ca74..ceb8c73f211 100644 --- a/htdocs/takepos/floors.php +++ b/htdocs/takepos/floors.php @@ -45,7 +45,7 @@ if ($action=="getTables"){ $sql="SELECT * from ".MAIN_DB_PREFIX."takepos_floor_tables where floor=".$floor; $resql = $db->query($sql); $rows = array(); - while($row = $db->fetch_array ($resql)){ + while($row = $db->fetch_array($resql)){ $rows[] = $row; } echo json_encode($rows); @@ -62,15 +62,15 @@ if ($action=="update") if ($action=="updatename") { - $newname = preg_replace("/[^a-zA-Z0-9\s]/", "", $newname); // Only English chars - if (strlen($newname) > 3) $newname = substr($newname, 0, 3); // Only 3 chars + $newname = preg_replace("/[^a-zA-Z0-9\s]/", "", $newname); // Only English chars + if (strlen($newname) > 3) $newname = substr($newname, 0, 3); // Only 3 chars $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label='$newname' where label='$place'"); } if ($action=="add") { $asdf=$db->query("insert into ".MAIN_DB_PREFIX."takepos_floor_tables values ('', '', '', '45', '45', $floor)"); - $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label=rowid where label=''"); // No empty table names + $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label=rowid where label=''"); // No empty table names } // Title @@ -175,4 +175,4 @@ $( document ).ready(function() { - \ No newline at end of file + diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 2f2df5b8085..33524b80a8c 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -39,7 +39,7 @@ $place = GETPOST('place', 'int'); $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'"; $resql = $db->query($sql); -$row = $db->fetch_array ($resql); +$row = $db->fetch_array($resql); $placeid=$row[0]; if (! $placeid) $placeid=0; // Invoice not exist else{ diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 456ddcefdb5..d43c3195b92 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -34,7 +34,7 @@ $place=GETPOST('place', 'int'); if ($place>0){ $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'"; $resql = $db->query($sql); - $row = $db->fetch_array ($resql); + $row = $db->fetch_array($resql); $facid=$row[0]; } $object=new Facture($db);