PSR2.Methods.FunctionCallSignature.SpaceBeforeOpenBracket

This commit is contained in:
Frédéric FRANCE 2019-02-24 20:06:55 +01:00
parent f83f746123
commit 894123fb06
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
27 changed files with 169 additions and 166 deletions

View File

@ -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';

View File

@ -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';

View File

@ -428,5 +428,6 @@
<rule ref="PSR2.Classes.ClassDeclaration" />
<rule ref="PSR2.Methods.FunctionClosingBrace" />
<rule ref="PSR2.Files.EndFileNewline.TooMany" />
<rule ref="PSR2.Files.EndFileNewline.NoneFound" />
<rule ref="PSR2.Files.EndFileNewline.NoneFound" />
<rule ref="PSR2.Methods.FunctionCallSignature.SpaceBeforeOpenBracket" />
</ruleset>

View File

@ -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);

View File

@ -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 . '"' ;

View File

@ -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)

View File

@ -359,7 +359,7 @@ switch ($action)
// End of case: valide_facture
}
unset ($_SESSION['serObjFacturation']);
unset($_SESSION['serObjFacturation']);
$_SESSION['serObjFacturation'] = serialize($obj_facturation);

View File

@ -220,7 +220,7 @@ class Categories extends DolibarrApi
if ($this->category->update(DolibarrApiAccess::$user) > 0)
{
return $this->get ($id);
return $this->get($id);
}
else
{

View File

@ -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

View File

@ -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).'\'';
}

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
/* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
* 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 .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
if ($showempty)
$out .= '<option value=""></option>';
$num = $this->db->num_rows ($resql);
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
while ( $i < $num ) {
$obj = $this->db->fetch_object ($resql);
$obj = $this->db->fetch_object($resql);
$label = $obj->name;
if (empty($label)) {
$label=$obj->fk_element;
@ -466,9 +467,9 @@ class FormAdvTargetEmailing extends Form
}
$out .= '</select>';
} else {
dol_print_error ($this->db);
dol_print_error($this->db);
}
$this->db->free ($resql);
$this->db->free($resql);
return $out;
}
}
}

View File

@ -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 = '')
{

View File

@ -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);

View File

@ -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))

View File

@ -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();

View File

@ -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&OacuteN ";
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.";

View File

@ -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');

View File

@ -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) {

View File

@ -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);
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* 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 '<td align="center" class="libre"><input type="submit" class="bouton ON" name="choixjourajout[]" value="'.$numerojour.'"></td>'."\n";
} else { //bouton gris
} else {
//bouton gris
print '<td align="center" class="avant">'.$numerojour.'</td>'."\n";
}
}

View File

@ -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;
}

View File

@ -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
)

View File

@ -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 '<tr class="liste_total">';
print '<td colspan="2" align="left">'.$langs->trans('TotalTTC').'</td>';
if (!empty($conf->multicurrency->enabled)) {
if (!empty($conf->multicurrency->enabled)) {
print '<td></td>';
print '<td></td>';
print '<td></td>';
@ -1007,7 +1007,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '</b></td>';
print '<td align="right"><b>'.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits, 'MT')).'</b></td>';
print '<td align="right" id="result" style="font-weight: bold;"></td>';
if (!empty($conf->multicurrency->enabled)) {
if (!empty($conf->multicurrency->enabled)) {
print '<td align="right" id="multicurrency_result" style="font-weight: bold;"></td>';
}
print "</tr>\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.='<br>'.$langs->trans('ConfirmCustomerPayment', $multicurrency_totalpayment, $langs->trans("paymentInInvoiceCurrency"));
}
if (!empty($multicurrency_totalpayment)) {
$text.='<br>'.$langs->trans('ConfirmCustomerPayment', $multicurrency_totalpayment, $langs->trans("paymentInInvoiceCurrency"));
}
if (GETPOST('closepaidinvoices'))
{
$text.='<br>'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed");

View File

@ -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);
}

View File

@ -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() {
</center>
</div>
</body>
</html>
</html>

View File

@ -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{

View File

@ -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);