Merge pull request #1550 from GPCsolutions/staticanalysis

Various fixes to defects found using statical analysis tooling
This commit is contained in:
Laurent Destailleur 2014-04-23 21:20:39 +02:00
commit 03d73bce9c
99 changed files with 283 additions and 253 deletions

View File

@ -38,7 +38,7 @@ $action=GETPOST('action','alpha');
$update=GETPOST('update','alpha');
$delete=GETPOST('delete'); // Do not use alpha here
$debug=GETPOST('debug','int');
$consts=GETPOST('const');
$consts=GETPOST('const','array');
$constname=GETPOST('constname','alpha');
$constvalue=GETPOST('constvalue');
$constnote=GETPOST('constnote','alpha');

View File

@ -60,7 +60,7 @@ if ((isset($_POST['roworder']) && ! empty($_POST['roworder'])) && (isset($_POST[
$row->table_element_line = $table_element_line;
$row->fk_element = $fk_element;
$row->id = $element_id;
$result=$row->line_ajaxorder($newrowordertab);
$row->line_ajaxorder($newrowordertab);
// Reorder line to have position of chilren lines sharing same counter than parent lines
// This should be useless because there is no need to have children sharing same counter that parent.

View File

@ -62,7 +62,7 @@ abstract class CommonDocGenerator
'myuser_fax'=>$user->office_fax,
'myuser_mobile'=>$user->user_mobile,
'myuser_email'=>$user->email,
'myuser_logo'=>$logotouse,
'myuser_logo'=>$user->photo,
'myuser_web'=>'' // url not exist in $user object
);
}
@ -139,7 +139,7 @@ abstract class CommonDocGenerator
{
$object->country=$outputlangs->transnoentitiesnoconv("Country".$object->country_code);
}
if (empty($mysoc->state) && ! empty($mysoc->state_code))
if (empty($object->state) && ! empty($object->state_code))
{
$object->state=getState($object->state_code,0);
}
@ -418,7 +418,7 @@ abstract class CommonDocGenerator
* @param Object $object Object with extrafields (must have $object->array_options filled)
* @param array $array_to_fill Substitution array
* @param Extrafields $extrafields Extrafields object
* @param array_key $array_key Name of the key for return array
* @param string $array_key Name of the key for return array
* @param Translate $outputlangs Lang object to use for output
* @return array Substitution array
*/

View File

@ -253,6 +253,7 @@ abstract class CommonInvoice extends CommonObject
}
if ($mode == 4)
{
$prefix='';
if (! $paye)
{
if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('BillStatusDraft');

View File

@ -83,10 +83,10 @@ abstract class CommonObject
if (empty($firstname)) $firstname=$this->firstname;
$ret='';
if ($option && $this->civilite_id)
if ($option && $this->civility_id)
{
if ($langs->transnoentitiesnoconv("Civility".$this->civilite_id)!="Civility".$this->civilite_id) $ret.=$langs->transnoentitiesnoconv("Civility".$this->civilite_id).' ';
else $ret.=$this->civilite_id.' ';
if ($langs->transnoentitiesnoconv("Civility".$this->civility_id)!="Civility".$this->civility_id) $ret.=$langs->transnoentitiesnoconv("Civility".$this->civility_id).' ';
else $ret.=$this->civility_id.' ';
}
$ret.=dolGetFirstLastname($firstname, $lastname, $nameorder);
@ -241,8 +241,8 @@ abstract class CommonObject
/**
* Copy contact from one element to current
*
* @param int $objFrom Source element
* @param int $source Nature of contact ('internal' or 'external')
* @param CommonObject $objFrom Source element
* @param string $source Nature of contact ('internal' or 'external')
* @return int >0 if OK, <0 if KO
*/
function copy_linked_contact($objFrom, $source='internal')
@ -1721,7 +1721,7 @@ abstract class CommonObject
* @param string $clause OR, AND clause
* @return void
*/
function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR')
function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR')
{
global $conf;
@ -2278,7 +2278,7 @@ abstract class CommonObject
*/
function showOptionals($extrafields, $mode='view', $params=0, $keyprefix='')
{
global $_POST;
global $_POST, $conf;
$out = '';
@ -2482,7 +2482,7 @@ abstract class CommonObject
$i=0;
while ($i < $num)
{
$obj = $this->db->fetch_object($query);
$obj = $this->db->fetch_object($resql);
$pu_ht = $obj->pu_ht;
$qty= $obj->qty;

View File

@ -119,6 +119,8 @@ class Conf
*/
function setValues($db)
{
global $conf;
dol_syslog(get_class($this)."::setValues");
/*

View File

@ -34,7 +34,7 @@ class DolCookie
var $myExpire;
var $myPath;
var $myDomain;
var $mySsecure;
var $mySecure;
var $cookiearray;
var $cookie;
@ -80,7 +80,7 @@ class DolCookie
/**
* Decrypt the cookie
*
* @return void
* @return string
*/
function decryptCookie()
{
@ -144,4 +144,4 @@ class DolCookie
}
?>
?>

View File

@ -188,7 +188,7 @@ class DiscountAbsolute
// Check if we can remove the discount
if ($this->fk_facture_source)
{
$sql.="SELECT COUNT(rowid) as nb";
$sql="SELECT COUNT(rowid) as nb";
$sql.=" FROM ".MAIN_DB_PREFIX."societe_remise_except";
$sql.=" WHERE (fk_facture_line IS NOT NULL"; // Not used as absolute simple discount
$sql.=" OR fk_facture IS NOT NULL)"; // Not used as credit note and not used as deposit

View File

@ -126,7 +126,7 @@ class dolprintIPP
*/
function list_jobs($module)
{
global $conf,$db;
global $conf, $db, $bc;
include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php';
$ipp = new CupsPrintIPP();
$ipp->setLog(DOL_DATA_ROOT.'/printipp.log','file',3); // logging very verbose

View File

@ -207,16 +207,16 @@ class ExtraFields
/**
* Add description of a new optional attribute
*
* @param string $attrname code of attribute
* @param string $label label of attribute
* @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour', 'float')
* @param int $pos Position of attribute
* @param int $size Size/length of attribute
* @param string $elementtype Element type ('member', 'product', 'company', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @return int <=0 if KO, >0 if OK
* @param string $attrname code of attribute
* @param string $label label of attribute
* @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour', 'float')
* @param int $pos Position of attribute
* @param int $size Size/length of attribute
* @param string $elementtype Element type ('member', 'product', 'company', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @param array||string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @return int <=0 if KO, >0 if OK
*/
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='')
{
@ -581,7 +581,7 @@ class ExtraFields
*/
function showInputField($key,$value,$moreparam='',$keyprefix='')
{
global $conf,$langs;
global $conf,$langs,$db;
$label=$this->attribute_label[$key];
$type =$this->attribute_type[$key];

View File

@ -558,7 +558,8 @@ class FileUpload
isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] : (isset($upload['name']) ? $upload['name'] : null),
isset($_SERVER['HTTP_X_FILE_SIZE']) ? $_SERVER['HTTP_X_FILE_SIZE'] : (isset($upload['size']) ? $upload['size'] : null),
isset($_SERVER['HTTP_X_FILE_TYPE']) ? $_SERVER['HTTP_X_FILE_TYPE'] : (isset($upload['type']) ? $upload['type'] : null),
isset($upload['error']) ? $upload['error'] : null
isset($upload['error']) ? $upload['error'] : null,
0
);
}
header('Vary: Accept');

View File

@ -3160,7 +3160,7 @@ class Form
*/
function form_contacts($page, $societe, $selected='', $htmlname='contactidp')
{
global $langs;
global $langs, $conf;
if ($htmlname != "none")
{

View File

@ -199,9 +199,9 @@ class FormAdmin
/**
* Return combo list of available menu families
*
* @param string $selected Menu pre-selected
* @param string $htmlname Name of html select
* @param string $dirmenuarray Directories to scan
* @param string $selected Menu pre-selected
* @param string $htmlname Name of html select
* @param string[] $dirmenuarray Directories to scan
* @return void
*/
function select_menu_families($selected, $htmlname, $dirmenuarray)

View File

@ -257,8 +257,7 @@ class FormFile
*/
function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='')
{
global $langs,$conf,$hookmanager;
global $bc;
global $langs,$conf,$hookmanager,$user,$bc;
// filedir = $conf->...->dir_ouput."/".get_exdir(id)
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';

View File

@ -58,7 +58,8 @@ class FormMail
var $withreplytoreadonly;
var $withtoreadonly;
var $withtoccreadonly;
var $withtopicreadonly;
var $withtocccreadonly;
var $withtopicreadonly;
var $withfilereadonly;
var $withdeliveryreceipt;
var $withcancel;
@ -95,6 +96,7 @@ class FormMail
$this->withreplytoreadonly=1;
$this->withtoreadonly=0;
$this->withtoccreadonly=0;
$this->withtocccreadonly=0;
$this->witherrorstoreadonly=0;
$this->withtopicreadonly=0;
$this->withfilereadonly=0;

View File

@ -391,7 +391,7 @@ class FormOther
$moreinfo=0;
if (! empty($conf->global->MAIN_SHOW_LOGIN))
{
$out.=($moreinfo?' - ':' (').$obj->login;
$moreforfilter.=($moreinfo?' - ':' (').$obj_usr->login;
$moreinfo++;
}
if ($showstatus >= 0)
@ -1095,9 +1095,10 @@ class FormOther
* @param string $labelfield Label field
* @param string $selected Selected value
* @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
* @param string $moreattrib More attributes on HTML select tag
* @return void
*/
function select_dictionary($htmlname,$dictionarytable,$keyfield='code',$labelfield='label',$selected='',$useempty=0)
function select_dictionary($htmlname,$dictionarytable,$keyfield='code',$labelfield='label',$selected='',$useempty=0,$moreattrib='')
{
global $langs, $conf;

View File

@ -213,6 +213,7 @@ function limitChars(textarea, limit, infodiv)
else
{
dol_syslog("Warning: The SMS sending method has not been defined into MAIN_SMS_SENDMODE", LOG_WARNING);
$resultsender=array();
$resultsender[0]->number=$this->fromsms;
}

View File

@ -201,7 +201,7 @@ class InfoBox
$tab[$confuserzone]=1;
if (dol_set_user_param($db, $conf, $user, $tab) < 0)
{
$this->error=$db->lasterror();
$error=$db->lasterror();
$db->rollback();
return -3;
}

View File

@ -359,10 +359,10 @@ class Ldap
* Add a LDAP entry
* Ldap object connect and bind must have been done
*
* @param string $dn DN entry key
* @param string $info Attributes array
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
* @param string $dn DN entry key
* @param string[] $info Attributes array
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
*/
function add($dn, $info, $user)
{
@ -413,7 +413,7 @@ class Ldap
* Ldap object connect and bind must have been done
*
* @param string $dn DN entry key
* @param string $info Attributes array
* @param string[] $info Attributes array
* @param string $user Objet user that modify
* @return int <0 if KO, >0 if OK
*/
@ -465,7 +465,7 @@ class Ldap
* Ldap object connect and bind must have been done
*
* @param string $dn DN entry key
* @param string $info Attributes array
* @param string[] $info Attributes array
* @param User $user Objet user that update
* @param string $olddn Old DN entry key (before update)
* @return int <0 if KO, >0 if OK
@ -552,9 +552,9 @@ class Ldap
/**
* Build a LDAP message
*
* @param string $dn DN entry key
* @param string $info Attributes array
* @return string Content of file
* @param string $dn DN entry key
* @param string[] $info Attributes array
* @return string Content of file
*/
function dump_content($dn, $info)
{
@ -594,9 +594,9 @@ class Ldap
/**
* Dump a LDAP message to ldapinput.in file
*
* @param string $dn DN entry key
* @param string $info Attributes array
* @return int <0 if KO, >0 if OK
* @param string $dn DN entry key
* @param string[] $info Attributes array
* @return int <0 if KO, >0 if OK
*/
function dump($dn, $info)
{
@ -631,10 +631,10 @@ class Ldap
* Add a LDAP attribute in entry
* Ldap object connect and bind must have been done
*
* @param string $dn DN entry key
* @param string $info Attributes array
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
* @param string $dn DN entry key
* @param string[] $info Attributes array
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
*/
function addAttribute($dn, $info, $user)
{
@ -683,10 +683,10 @@ class Ldap
* Update a LDAP attribute in entry
* Ldap object connect and bind must have been done
*
* @param string $dn DN entry key
* @param string $info Attributes array
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
* @param string $dn DN entry key
* @param string[] $info Attributes array
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
*/
function updateAttribute($dn, $info, $user)
{
@ -735,10 +735,10 @@ class Ldap
* Delete a LDAP attribute in entry
* Ldap object connect and bind must have been done
*
* @param string $dn DN entry key
* @param string $info Attributes array
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
* @param string $dn DN entry key
* @param string[] $info Attributes array
* @param User $user Objet user that create
* @return int <0 if KO, >0 if OK
*/
function deleteAttribute($dn, $info, $user)
{
@ -1370,4 +1370,4 @@ class Ldap
}
?>
?>

View File

@ -403,13 +403,13 @@ class Menubase
/**
* Load entries found from database in this->newmenu array.
*
* @param array $newmenu Menu array to complete (in most cases, it's empty, may be already initialized with some menu manager like eldy)
* @param Menu $newmenu Menu array to complete (in most cases, it's empty, may be already initialized with some menu manager like eldy)
* @param string $mymainmenu Value for mainmenu to filter menu to load (often $_SESSION["mainmenu"])
* @param string $myleftmenu Value for leftmenu to filter menu to load (always '')
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param string $menu_handler Filter on name of menu_handler used (auguria, eldy...)
* @param array &$tabMenu Array with menu entries already loaded
* @return array Menu array for particular mainmenu value or full tabArray
* @return Menu Menu array for particular mainmenu value or full tabArray
*/
function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
{

View File

@ -174,7 +174,7 @@ class RssParser
* @param string $urlRSS Url to parse
* @param int $maxNb Max nb of records to get (0 for no limit)
* @param int $cachedelay 0=No cache, nb of seconds we accept cache files (cachedir must also be defined)
* @param strnig $cachedir Directory where to save cache file
* @param string $cachedir Directory where to save cache file
* @return int <0 if KO, >0 if OK
*/
public function parser($urlRSS, $maxNb=0, $cachedelay=60, $cachedir='')
@ -722,7 +722,7 @@ class RssParser
/**
* Function to convert an XML object into an array
*
* @param string $xml Xml
* @param SimpleXMLElement $xml Xml
* @return void
*/
function xml2php($xml)
@ -775,4 +775,4 @@ function xml2php($xml)
}
?>
?>

View File

@ -491,9 +491,10 @@ abstract class Stats
*
* @param int $year Year
* @param string $sql SQL
* @return array
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is a number
* @return array
*/
function _getAverageByMonth($year, $sql)
function _getAverageByMonth($year, $sql, $format=0)
{
$result=array();
$res=array();

View File

@ -703,7 +703,7 @@ class Translate
*/
function getCurrencyAmount($currency_code, $amount)
{
$symbol=$this->getCurrencSymbol($currency_code);
$symbol=$this->getCurrencySymbol($currency_code);
if (in_array($currency_code, array('USD'))) return $symbol.$amount;
else return $amount.$symbol;

View File

@ -51,7 +51,7 @@ function RemoveFromEnd($sourceString, $charToRemove)
/**
* FindBadUtf8
*
* @param unknown_type $string String
* @param string $string String
* @return boolean
*/
function FindBadUtf8($string)

View File

@ -386,14 +386,14 @@ function agenda_prepare_head()
$head[$h][2] = 'other';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'agenda_admin');
complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin');
$head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php";
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributes';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'agenda_admin','remove');
complete_head_from_modules($conf,$langs,null,$head,$h,'agenda_admin','remove');
return $head;

View File

@ -272,7 +272,7 @@ function ajax_dialog($title,$message,$w=350,$h=150)
{
global $langs;
$msg.= '<div id="dialog-info" title="'.dol_escape_htmltag($title).'">';
$msg= '<div id="dialog-info" title="'.dol_escape_htmltag($title).'">';
$msg.= $message;
$msg.= '</div>'."\n";
$msg.= '<script type="text/javascript">

View File

@ -88,12 +88,12 @@ function categoriesadmin_prepare_head()
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'categoriesadmin');
complete_head_from_modules($conf,$langs,null,$head,$h,'categoriesadmin');
complete_head_from_modules($conf,$langs,$object,$head,$h,'categoriesadmin','remove');
complete_head_from_modules($conf,$langs,null,$head,$h,'categoriesadmin','remove');
return $head;
}
?>
?>

View File

@ -178,7 +178,7 @@ function societe_prepare_head2($object)
if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT))
{
$head[$h][0] = DOL_URL_ROOT .'/societe/rib.php?socid='.$object->id;
$head[$h][1] = $langs->trans("BankAccount")." $account->number";
$head[$h][1] = $langs->trans("BankAccount");
$head[$h][2] = 'rib';
$h++;
}
@ -659,10 +659,10 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$result = $db->query($sql);
$num = $db->num_rows($result);
if ($num)
$var=true;
if ($num)
{
$i=0;
$var=true;
while ($i < $num)
{

View File

@ -105,7 +105,7 @@ function contract_admin_prepare_head()
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'contract_admin');
complete_head_from_modules($conf,$langs,null,$head,$h,'contract_admin');
$head[$h][0] = DOL_URL_ROOT.'/contrat/admin/contract_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
@ -114,9 +114,9 @@ function contract_admin_prepare_head()
complete_head_from_modules($conf,$langs,$object,$head,$h,'contract_admin','remove');
complete_head_from_modules($conf,$langs,null,$head,$h,'contract_admin','remove');
return $head;
}
?>
?>

View File

@ -39,9 +39,9 @@ function cronadmin_prepare_head()
$head[$h][2] = 'setup';
$h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'cronadmin');
complete_head_from_modules($conf, $langs, null, $head, $h, 'cronadmin');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'cronadmin', 'remove');
complete_head_from_modules($conf, $langs, null, $head, $h, 'cronadmin', 'remove');
return $head;

View File

@ -442,7 +442,7 @@ function dol_get_next_week($day, $week, $month, $year)
* @param mixed $gm False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date.
* Exemple: dol_get_first_day(1970,1,false) will return -3600 with TZ+1, after a dol_print_date will return 1970-01-01 00:00:00
* Exemple: dol_get_first_day(1970,1,true) will return 0 whatever is TZ, after a dol_print_date will return 1970-01-01 00:00:00
* @return timestamp Date for first day
* @return int Date for first day
*/
function dol_get_first_day($year,$month=1,$gm=false)
{
@ -455,7 +455,7 @@ function dol_get_first_day($year,$month=1,$gm=false)
* @param int $year Year
* @param int $month Month
* @param boolean $gm False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date.
* @return timestamp Date for first day
* @return int Date for first day
*/
function dol_get_last_day($year,$month=12,$gm=false)
{
@ -551,8 +551,8 @@ function dol_get_first_day_week($day,$month,$year,$gm=false)
* Fonction retournant le nombre de jour feries, samedis et dimanches entre 2 dates entrees en timestamp. Dates must be UTC with hour, day, min to 0
* Called by function num_open_day
*
* @param timestamp $timestampStart Timestamp de debut
* @param timestamp $timestampEnd Timestamp de fin
* @param int $timestampStart Timestamp de debut
* @param int $timestampEnd Timestamp de fin
* @param string $countrycode Country code
* @return int Nombre de jours feries
*/
@ -685,8 +685,8 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
* Function to return number of days between two dates (date must be UTC date !)
* Example: 2012-01-01 2012-01-02 => 1 if lastday=0, 2 if lastday=1
*
* @param timestamp $timestampStart Timestamp start UTC
* @param timestamp $timestampEnd Timestamp end UTC
* @param int $timestampStart Timestamp start UTC
* @param int $timestampEnd Timestamp end UTC
* @param int $lastday Last day is included, 0: non, 1:oui
* @return int Number of days
*/
@ -711,8 +711,8 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0)
/**
* Function to return number of working days (and text of units) between two dates (working days)
*
* @param timestamp $timestampStart Timestamp for start date (date must be UTC to avoid calculation errors)
* @param timestamp $timestampEnd Timestamp for end date (date must be UTC to avoid calculation errors)
* @param int $timestampStart Timestamp for start date (date must be UTC to avoid calculation errors)
* @param int $timestampEnd Timestamp for end date (date must be UTC to avoid calculation errors)
* @param int $inhour 0: return number of days, 1: return number of hours
* @param int $lastday We include last day, 0: no, 1:yes
* @param int $halfday Tag to define half day when holiday start and end

View File

@ -119,7 +119,7 @@ function fichinter_admin_prepare_head()
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'fichinter_admin');
complete_head_from_modules($conf,$langs,null,$head,$h,'fichinter_admin');
$head[$h][0] = DOL_URL_ROOT.'/fichinter/admin/fichinter_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
@ -128,7 +128,7 @@ function fichinter_admin_prepare_head()
complete_head_from_modules($conf,$langs,$object,$head,$h,'fichinter_admin','remove');
complete_head_from_modules($conf,$langs,null,$head,$h,'fichinter_admin','remove');
return $head;
}

View File

@ -39,16 +39,16 @@ function dol_basename($pathfile)
* Scan a directory and return a list of files/directories.
* Content for string is UTF8 and dir separator is "/".
*
* @param string $path Starting path from which to search
* @param string $types Can be "directories", "files", or "all"
* @param int $recursive Determines whether subdirectories are searched
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
* @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.'))
* @param string $sortcriteria Sort criteria ("","fullname","name","date","size")
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
* @param int $nohook Disable all hooks
* @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file')
* @param string $path Starting path from which to search
* @param string $types Can be "directories", "files", or "all"
* @param int $recursive Determines whether subdirectories are searched
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
* @param string[] $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.'))
* @param string $sortcriteria Sort criteria ("","fullname","name","date","size")
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
* @param int $nohook Disable all hooks
* @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file')
*/
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=false)
{
@ -879,7 +879,7 @@ function dol_delete_preview($object)
{
if ( ! dol_delete_file($file,1) )
{
$this->error=$langs->trans("ErrorFailedToOpenFile",$file);
$object->error=$langs->trans("ErrorFailedToOpenFile",$file);
return 0;
}
}
@ -893,7 +893,7 @@ function dol_delete_preview($object)
{
if ( ! dol_delete_file($preview,1) )
{
$this->error=$langs->trans("ErrorFailedToOpenFile",$preview);
$object->error=$langs->trans("ErrorFailedToOpenFile",$preview);
return 0;
}
}
@ -1279,11 +1279,11 @@ function dol_uncompress($inputfile,$outputdir)
/**
* Return file(s) into a directory (by default most recent)
*
* @param string $dir Directory to scan
* @param string $regexfilter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
* @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function
* @param int $nohook Disable all hooks
* @return string Full path to most recent file
* @param string $dir Directory to scan
* @param string $regexfilter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
* @param string[] $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function
* @param int $nohook Disable all hooks
* @return string Full path to most recent file
*/
function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('\.meta$','^\.'),$nohook=false)
{
@ -1755,7 +1755,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
{
$accessallowed=1;
$dir='files';
if ($type == 'application/x-bittorrent') $dir='torrents';
if (dol_mimetype($original_file) == 'application/x-bittorrent') $dir='torrents';
$original_file=$conf->bittorrent->dir_output.'/'.$dir.'/'.$original_file;
}

View File

@ -174,7 +174,7 @@ function dol_shutdown()
* @param string $paramname Name of parameter to found
* @param string $check Type of check (''=no check, 'int'=check it's numeric, 'alpha'=check it's text and sign, 'az'=check it's a-z only, 'array'=check it's array)
* @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get, 4 = post then get then cookie)
* @return string Value found, or '' if check fails
* @return string||string[] Value found, or '' if check fails
*/
function GETPOST($paramname,$check='',$method=0)
{
@ -715,6 +715,8 @@ function dol_bc($var,$moreclass='')
*/
function dol_format_address($object,$withcountry=0,$sep="\n")
{
global $conf;
$ret='';
$countriesusingstate=array('AU','US','IN','GB','ES','UK','TR');
@ -1428,7 +1430,7 @@ function dol_print_address($address, $htmlid, $mode, $id)
{
if ($hookmanager) {
$parameters = array('element' => $mode, 'id' => $id);
$reshook = $hookmanager->executeHooks('printAddress', $parameters, $address, $action);
$reshook = $hookmanager->executeHooks('printAddress', $parameters, $address);
print $hookmanager->resPrint;
}
if (empty($reshook)) {

View File

@ -658,7 +658,7 @@ function moneyMeter($actualValue=0, $pendingValue=0, $intentValue=0)
// actual
$sectionHeight = round(($actualValue / $maximumValue) * $height);
$totalHeight = $totalHeight + $sectionHeight;
$totalHeight = $sectionHeight;
if ( $sectionHeight > 0 )
{
$section = $formSection;
@ -669,7 +669,7 @@ function moneyMeter($actualValue=0, $pendingValue=0, $intentValue=0)
// pending
$sectionHeight = round(($pendingValue / $maximumValue) * $height);
$totalHeight = $totalHeight + $sectionHeight;
$totalHeight += $sectionHeight;
if ( $sectionHeight > 0 )
{
$section = $formSection;
@ -680,7 +680,7 @@ function moneyMeter($actualValue=0, $pendingValue=0, $intentValue=0)
// intent
$sectionHeight = round(($intentValue / $maximumValue) * $height);
$totalHeight = $totalHeight + $sectionHeight;
$totalHeight += $sectionHeight;
if ( $sectionHeight > 0 )
{
$section = $formSection;

View File

@ -490,7 +490,7 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
* @param Account $account Bank account object
* @param int $onlynumber Output only number
* @param int $default_font_size Default font size
* @return void
* @return float The Y PDF position
*/
function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default_font_size=10)
{
@ -863,7 +863,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
* @param float $h Cell minimum height. The cell extends automatically if needed.
* @param int $align Align
* @param string $default_font_size Font size
* @return void
* @return float The Y PDF position
*/
function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$align,$default_font_size)
{
@ -1186,7 +1186,7 @@ function pdf_getlineref_supplier($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void
* @return string
*/
function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
{
@ -1213,7 +1213,7 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void
* @return string
*/
function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
{
@ -1271,7 +1271,7 @@ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void
* @return string
*/
function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0)
{
@ -1301,7 +1301,7 @@ function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void
* @return string
*/
function pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails=0)
{
@ -1331,7 +1331,7 @@ function pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void
* @return string
*/
function pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails=0)
{
@ -1391,7 +1391,7 @@ function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0)
* @param int $i Current line number
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void
* @return string
*/
function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
{

View File

@ -45,7 +45,7 @@
* @param string $price_base_type HT=on calcule sur le HT, TTC=on calcule sur le TTC
* @param int $info_bits Miscellaneous informations on line
* @param int $type 0/1=Product/service
* @param string $seller Thirdparty seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc.
* @param Societe $seller Thirdparty seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc.
* @param array $localtaxes_array Array with localtaxes info (loaded by getLocalTaxesFromRate function).
* @return result[ 0=total_ht,
* 1=total_vat,

View File

@ -179,7 +179,7 @@ function project_admin_prepare_head()
$head[$h][2] = 'project';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'project_admin');
complete_head_from_modules($conf,$langs,null,$head,$h,'project_admin');
$head[$h][0] = DOL_URL_ROOT."/projet/admin/project_extrafields.php";
$head[$h][1] = $langs->trans("ExtraFieldsProject");
@ -191,7 +191,7 @@ function project_admin_prepare_head()
$head[$h][2] = 'attributes_task';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'project_admin','remove');
complete_head_from_modules($conf,$langs,null,$head,$h,'project_admin','remove');
return $head;
}

View File

@ -179,9 +179,9 @@ function user_admin_prepare_head()
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'useradmin');
complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin');
complete_head_from_modules($conf,$langs,$object,$head,$h,'useradmin','remove');
complete_head_from_modules($conf,$langs,null,$head,$h,'useradmin','remove');
return $head;
}

View File

@ -202,11 +202,11 @@ function print_end_menu_array_auguria()
* @param array $menu_array_before Table of menu entries to show before entries of menu handler
* @param array $menu_array_after Table of menu entries to show after entries of menu handler
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param array &$menu Object Menu to return back list of menu entries
* @param Menu &$menu Object Menu to return back list of menu entries
* @param int $noout Disable output (Initialise &$menu only).
* @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x'
* @param string $forceleftmenu 'all'=Force leftmenu to '' (= all)
* @return void
* @return int
*/
function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabMenu,&$menu,$noout=0,$forcemainmenu='',$forceleftmenu='')
{

View File

@ -158,7 +158,7 @@ class MenuManager
* Show menu
*
* @param string $mode 'top', 'left', 'jmobile'
* @return int Number of menu entries shown
* @return void
*/
function showmenu($mode)
{
@ -172,16 +172,14 @@ class MenuManager
$conf->global->MAIN_SEARCHFORM_CONTACT=0;
}
$res='ErrorBadParameterForMode';
require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php';
$this->menu=new Menu();
if ($mode == 'top') $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0);
if ($mode == 'left') $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0);
if ($mode == 'top') print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0);
if ($mode == 'left') print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0);
if ($mode == 'jmobile')
{
$res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1);
print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1);
print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n";
foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
@ -199,7 +197,7 @@ class MenuManager
$tmpmainmenu=$val['mainmenu'];
$tmpleftmenu='all';
$submenu=new Menu();
$res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu);
print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu);
$nexturl=dol_buildpath($submenu->liste[0]['url'],1);
$canonrelurl=preg_replace('/\?.*$/','',$relurl);
@ -248,8 +246,6 @@ class MenuManager
}
unset($this->menu);
return $res;
}
}

View File

@ -427,11 +427,11 @@ function print_end_menu_array()
* @param array $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add)
* @param array $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add)
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param array &$menu Object Menu to return back list of menu entries
* @param Menu &$menu Object Menu to return back list of menu entries
* @param int $noout Disable output (Initialise &$menu only).
* @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x'
* @param string $forceleftmenu 'all'=Force leftmenu to '' (= all)
* @return void
* @return int
*/
function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu,&$menu,$noout=0,$forcemainmenu='',$forceleftmenu='')
{

View File

@ -112,7 +112,7 @@ class MenuManager
* Show menu
*
* @param string $mode 'top', 'left', 'jmobile'
* @return int Number of menu entries shown
* @return void
*/
function showmenu($mode)
{
@ -126,26 +126,24 @@ class MenuManager
$conf->global->MAIN_SEARCHFORM_CONTACT=0;
}
$res='ErrorBadParameterForMode';
require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php';
$this->menu=new Menu();
if (empty($conf->global->MAIN_MENU_INVERT))
{
if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0);
if ($mode == 'left') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0);
if ($mode == 'top') print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0);
if ($mode == 'left') print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0);
}
else
{
$conf->global->MAIN_SHOW_LOGO=0;
if ($mode == 'top') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0);
if ($mode == 'left') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0);
if ($mode == 'top') print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu,0);
if ($mode == 'left') print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,0);
}
if ($mode == 'jmobile')
{
$res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1);
print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1);
print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n";
foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
@ -163,7 +161,7 @@ class MenuManager
$tmpmainmenu=$val['mainmenu'];
$tmpleftmenu='all';
$submenu=new Menu();
$res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu);
print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu);
$nexturl=dol_buildpath($submenu->liste[0]['url'],1);
$canonrelurl=preg_replace('/\?.*$/','',$relurl);
@ -221,7 +219,6 @@ class MenuManager
unset($this->menu);
//print 'xx'.$mode;
return $res;
}
}

View File

@ -300,7 +300,7 @@ function print_start_menu_entry_empty($idsel,$classname,$showmode)
*/
function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $classname, $atarget)
{
global $conf;
global $conf,$langs;
if ($showmode == 1)
{

View File

@ -165,6 +165,8 @@ class CommActionRapport
*/
function _pages(&$pdf, $outputlangs)
{
global $conf;
$height=3; // height for text separation
$pagenb=1;

View File

@ -62,7 +62,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
/** Return description of module
*
* @param string $langs Object langs
* @param Translate $langs Object langs
* @return string Description of module
*/
function info($langs)
@ -104,7 +104,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
* Return an example of result returned by getNextValue
*
* @param Translate $langs Object langs
* @param product $objproduct Object product
* @param Product $objproduct Object product
* @return string Return string example
*/
function getExample($langs,$objproduct=0)

View File

@ -66,7 +66,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
*/
function canBeActivated()
{
global $conf,$langs;
global $conf,$langs,$db;
$coyymm=''; $max='';

View File

@ -237,7 +237,7 @@ function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers('ORDER_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
if ($result < 0) { $error++; $obj->errors=$interface->errors; }
// Fin appel triggers
return 1;

View File

@ -96,13 +96,13 @@ class pdf_strato extends ModelePDFContract
/**
* Function to build pdf onto disk
*
* @param int $object Id of object to generate
* @param object $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
* @param CommonObject $object Id of object to generate
* @param object $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{
@ -253,6 +253,7 @@ class pdf_strato extends ModelePDFContract
$valide = $objectligne->id ? $objectligne->fetch($objectligne->id) : 0;
if ($valide > 0 || $object->specimen)
{
$curX = $this->posxdesc-1;
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0,0,0);

View File

@ -64,7 +64,7 @@ class mod_contract_serpis extends ModelNumRefContracts
*/
function canBeActivated()
{
global $conf,$langs;
global $conf,$langs,$db;
$coyymm=''; $max='';

View File

@ -231,7 +231,7 @@ function contract_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers('CONTRACT_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
if ($result < 0) { $error++; $obj->errors=$interface->errors; }
// Fin appel triggers
return 1;

View File

@ -147,9 +147,12 @@ abstract class ModeleNumRefDons
* @param string $message Message
* @param string $modele Force le modele a utiliser ('' par defaut)
* @param Translate $outputlangs Object langs
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @return int 0 if KO, 1 if OK
*/
function don_create($db, $id, $message, $modele, $outputlangs)
function don_create($db, $id, $message, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $conf, $langs;
$langs->load("bills");
@ -241,7 +244,7 @@ function don_create($db, $id, $message, $modele, $outputlangs)
}
else
{
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file);
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file);
return 0;
}
}

View File

@ -431,7 +431,7 @@ class pdf_merou extends ModelePdfExpedition
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $conf, $langs;
global $conf, $langs,$hookmanager;
$default_font_size = pdf_getPDFFontSize($outputlangs);

View File

@ -64,7 +64,7 @@ class mod_expedition_safor extends ModelNumRefExpedition
*/
function canBeActivated()
{
global $conf,$langs;
global $conf,$langs,$db;
$coyymm=''; $max='';

View File

@ -227,7 +227,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
$interface=new Interfaces($db);
$result=$interface->run_triggers('SHIPPING_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
$error++; $obj->errors=$interface->errors;
}
// End calls triggers
@ -254,4 +254,4 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
return 0;
}
}
?>
?>

View File

@ -228,6 +228,8 @@ class ExportExcel extends ModeleExports
*/
function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs,$array_types)
{
global $conf;
// Create a format for the column headings
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
{
@ -281,6 +283,8 @@ class ExportExcel extends ModeleExports
*/
function write_record($array_selected_sorted,$objp,$outputlangs,$array_types)
{
global $conf;
// Create a format for the column headings
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
{
@ -398,6 +402,8 @@ class ExportExcel extends ModeleExports
*/
function close_file()
{
global $conf;
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
{
$this->workbook->close();

View File

@ -80,6 +80,8 @@ class ExportExcel2007 extends ExportExcel
*/
function close_file()
{
global $conf;
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
{
$this->workbook->close();

View File

@ -391,7 +391,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
}
// Fetch info for linked propal
$linked_propal = $object->fetchObjectLinked('','','','');
$object->fetchObjectLinked('','','','');
//print_r($object->linkedObjects['propal']); exit;
$propal_object = $object->linkedObjects['propal'][0];

View File

@ -67,7 +67,7 @@ class mod_facture_mars extends ModeleNumRefFactures
*/
function canBeActivated()
{
global $langs,$conf;
global $langs,$conf,$db;
$langs->load("bills");

View File

@ -65,7 +65,7 @@ class mod_facture_terre extends ModeleNumRefFactures
*/
function canBeActivated()
{
global $langs,$conf;
global $langs,$conf,$db;
$langs->load("bills");

View File

@ -96,13 +96,13 @@ class pdf_soleil extends ModelePDFFicheinter
/**
* Function to build pdf onto disk
*
* @param int $object Id of object to generate
* @param object $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
* @param CommonObject $object Id of object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{
@ -240,6 +240,7 @@ class pdf_soleil extends ModelePDFFicheinter
$valide = $objectligne->id ? $objectligne->fetch($objectligne->id) : 0;
if ($valide > 0 || $object->specimen)
{
$curX = $this->posxdesc-1;
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0,0,0);

View File

@ -65,7 +65,7 @@ class mod_pacific extends ModeleNumRefFicheinter
*/
function canBeActivated()
{
global $langs,$conf;
global $langs,$conf,$db;
$langs->load("bills");

View File

@ -227,7 +227,7 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers('FICHINTER_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
if ($result < 0) { $error++; $obj->errors=$interface->errors; }
// Fin appel triggers
return 1;

View File

@ -70,7 +70,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
*/
function canBeActivated()
{
global $langs,$conf;
global $langs,$conf,$db;
$langs->load("bills");

View File

@ -120,7 +120,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder
return 0;
}
$numFinal=get_next_value($db,$mask,'livraison','ref','',$objsoc->code_client,$livraison->date_livraison);
$numFinal=get_next_value($db,$mask,'livraison','ref','',$objsoc->code_client,$object->date_livraison);
return $numFinal;
}
@ -153,4 +153,4 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder
}
?>
?>

View File

@ -230,7 +230,7 @@ function delivery_order_pdf_create($db, $object, $modele, $outputlangs='')
$interface=new Interfaces($db);
$result=$interface->run_triggers('DELIVERY_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
$error++; $obj->errors=$interface->errors;
}
// Fin appel triggers
@ -251,4 +251,4 @@ function delivery_order_pdf_create($db, $object, $modele, $outputlangs='')
}
}
?>
?>

View File

@ -438,7 +438,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
}
// Affiche zone infos
$posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
// Pied de page
$this->_pagefoot($pdf,$object,$outputlangs);
@ -685,7 +685,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$pdf->SetTextColor(0,0,60);
if ($object->date_valid)
{
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date(($object->date_delivery?$object->date_delivery:$date->valid),"%d %b %Y",false,$outputlangs,true), '', 'R');
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_delivery,"%d %b %Y",false,$outputlangs,true), '', 'R');
}
else
{

View File

@ -156,11 +156,11 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs)
else
{
dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file));
dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file));
return -1;
}
}
?>
?>

View File

@ -149,7 +149,9 @@ class modCron extends DolibarrModules
*/
function init($options='')
{
// Prevent pb of modules not correctly disabled
$sql = array();
// Prevent pb of modules not correctly disabled
//$this->remove($options);
return $this->_init($sql,$options);

View File

@ -243,7 +243,7 @@ class modExpedition extends DolibarrModules
*/
function init($options='')
{
global $conf;
global $conf,$langs;
// Permissions
$this->remove($options);

View File

@ -298,7 +298,7 @@ class modProjet extends DolibarrModules
*/
function init($options='')
{
global $conf;
global $conf,$langs;
// Permissions
$this->remove($options);

View File

@ -99,6 +99,8 @@ class modSkype extends DolibarrModules
*/
function init($options='')
{
$sql = array();
// Prevent pb of modules not correctly disabled
//$this->remove($options);

View File

@ -63,7 +63,7 @@ class mod_codeproduct_elephant extends ModeleProductCode
/** Return description of module
*
* @param string $langs Object langs
* @param Translate $langs Object langs
* @return string Description of module
*/
function info($langs)

View File

@ -63,7 +63,7 @@ class mod_codeproduct_leopard extends ModeleProductCode
/** Return description of module
*
* @param string $langs Object langs
* @param Translate $langs Object langs
* @return string Description of module
*/
function info($langs)

View File

@ -67,7 +67,7 @@ class mod_project_simple extends ModeleNumRefProjects
*/
function canBeActivated()
{
global $conf,$langs;
global $conf,$langs,$db;
$coyymm=''; $max='';
@ -150,4 +150,4 @@ class mod_project_simple extends ModeleNumRefProjects
}
}
?>
?>

View File

@ -67,7 +67,7 @@ class mod_task_simple extends ModeleNumRefTask
*/
function canBeActivated()
{
global $conf,$langs;
global $conf,$langs,$db;
$coyymm=''; $max='';
@ -150,4 +150,4 @@ class mod_task_simple extends ModeleNumRefTask
}
}
?>
?>

View File

@ -562,7 +562,7 @@ class doc_generic_task_odt extends ModelePDFTask
if (!empty($project->fk_soc)) $socid = $project->fk_soc;
$tmparray=$this->get_substitutionarray_tasks($object,$outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $task);
complete_substitutions_array($tmparray, $outputlangs, $object);
foreach($tmparray as $key => $val)
{
try
@ -837,4 +837,4 @@ class doc_generic_task_odt extends ModelePDFTask
}
}
?>
?>

View File

@ -883,7 +883,7 @@ class pdf_azur extends ModelePDFPropales
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat = $outputlangs->transcountrynoentities("TotalLT2".$mysoc->country_code).' ';
$totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
$totalvat.=vatrate(abs($tvakey),1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);

View File

@ -68,7 +68,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
*/
function canBeActivated()
{
global $conf,$langs;
global $conf,$langs,$db;
$pryymm=''; $max='';

View File

@ -233,7 +233,7 @@ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers('PROPAL_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
if ($result < 0) { $error++; $obj->errors=$interface->errors; }
// Fin appel triggers
return 1;

View File

@ -38,7 +38,7 @@ class pdf_paiement
*/
function __construct($db)
{
global $langs;
global $langs,$conf;
$langs->load("bills");
$langs->load("compta");

View File

@ -64,7 +64,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
/** Return description of module
*
* @param string $langs Object langs
* @param Translate $langs Object langs
* @return string Description of module
*/
function info($langs)

View File

@ -62,7 +62,7 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode
/** Return description of module
*
* @param string $langs Object langs
* @param Translate $langs Object langs
* @return string Description of module
*/
function info($langs)
@ -119,4 +119,4 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode
}
}
?>
?>

View File

@ -64,7 +64,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
/** Return description of module
*
* @param string $langs Object langs
* @param Translate $langs Object langs
* @return string Description of module
*/
function info($langs)

View File

@ -46,7 +46,7 @@ class mod_codecompta_panicum extends ModeleAccountancyCode
/**
* Return description of module
*
* @param string $langs Object langs
* @param Translate $langs Object langs
* @return string Description of module
*/
function info($langs)

View File

@ -353,6 +353,8 @@ abstract class ModeleAccountancyCode
*/
function get_code($db, $societe, $type='')
{
global $langs;
return $langs->trans("NotAvailable");
}
}
@ -374,6 +376,7 @@ function thirdparty_doc_create($db, $object, $message, $modele, $outputlangs)
{
global $conf,$langs,$user;
$langs->load("bills");
$error=0;
$dir = DOL_DOCUMENT_ROOT . "/core/modules/societe/doc";
$srctemplatepath='';
@ -422,7 +425,7 @@ function thirdparty_doc_create($db, $object, $message, $modele, $outputlangs)
$interface=new Interfaces($db);
$result=$interface->run_triggers('COMPANY_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
$error++; $obj->errors=$interface->errors;
}
// Fin appel triggers

View File

@ -68,7 +68,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
*/
function canBeActivated()
{
global $conf,$langs;
global $conf,$langs,$db;
$siyymm=''; $max='';

View File

@ -224,7 +224,7 @@ function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hided
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers('BILL_SUPPLIER_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
if ($result < 0) { $error++; $obj->errors=$interface->errors; }
// End calls triggers
return 1;

View File

@ -127,13 +127,13 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
/**
* Function to build pdf onto disk
*
* @param int $object Id of object to generate
* @param object $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
* @param FactureFournisseur $object Id of object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
function write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
{

View File

@ -68,7 +68,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
*/
function canBeActivated()
{
global $conf,$langs;
global $conf,$langs,$db;
$coyymm=''; $max='';

View File

@ -230,7 +230,7 @@ function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedet
$interface=new Interfaces($db);
$result=$interface->run_triggers('ORDER_SUPPLIER_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
$error++; $obj->errors=$interface->errors;
}
// End calls triggers

View File

@ -132,17 +132,17 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
/**
* Function to build pdf onto disk
*
* @param int $object Id of object to generate
* @param object $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
* @param CommandeFournisseur $object Id of object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
function write_file($object,$outputlangs='',$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $user,$langs,$conf,$hookmanager;
global $user,$langs,$conf,$hookmanager,$mysoc;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO

View File

@ -112,7 +112,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
/**
* Output log content
*
* @param string $content Content to log
* @param array $content Content to log
* @return void
*/
public function export($content)
@ -133,14 +133,14 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
include_once 'ChromePhp.class.php';
set_include_path($oldinclude);
ob_start(); // To be sure headers are not flushed until all page is completely processed
if ($level == LOG_ERR) ChromePhp::error($message);
elseif ($level == LOG_WARNING) ChromePhp::warn($message);
elseif ($level == LOG_INFO) ChromePhp::log($message);
else ChromePhp::log($message);
if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']);
elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']);
elseif ($content['level'] == LOG_INFO) ChromePhp::log($content['message']);
else ChromePhp::log($content['message']);
}
catch (Exception $e)
{
// Do not use dol_syslog here to avoid infinite loop
}
}
}
}

View File

@ -110,7 +110,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
/**
* Output log content
*
* @param string $content Content to log
* @param array $content Content to log
* @return void
*/
public function export($content)
@ -132,10 +132,10 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
set_include_path($oldinclude);
ob_start(); // To be sure headers are not flushed until all page is completely processed
$firephp = FirePHP::getInstance(true);
if ($level == LOG_ERR) $firephp->error($message);
elseif ($level == LOG_WARNING) $firephp->warn($message);
elseif ($level == LOG_INFO) $firephp->log($message);
else $firephp->log($message);
if ($content['level'] == LOG_ERR) $firephp->error($content['message']);
elseif ($content['level'] == LOG_WARNING) $firephp->warn($content['message']);
elseif ($content['level'] == LOG_INFO) $firephp->log($content['message']);
else $firephp->log($content['message']);
}
catch (Exception $e)
{
@ -143,4 +143,4 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
return false;
}
}
}
}

View File

@ -65,6 +65,7 @@ $nbofsearch=0;
$hookmanager->initHooks(array('searchform'));
// Define $searchform
$searchform = '';
// TODO Mutualize code here with function left_menu into main.inc.php page
if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire)
{

View File

@ -916,7 +916,8 @@ class Cronjob extends CommonObject
if ($this->jobtype=='method')
{
// load classes
$ret=dol_include_once("/".$this->module_name."/class/".$this->classesname,$this->objectname);
$file = "/".$this->module_name."/class/".$this->classesname;
$ret=dol_include_once($file,$this->objectname);
if ($ret===false)
{
$this->error=$langs->trans('CronCannotLoadClass',$file,$this->objectname);

View File

@ -101,6 +101,7 @@ class Expedition extends CommonObject
$this->products = array();
// List of long language codes for status
$this->statuts = array();
$this->statuts[-1] = 'StatusSendingCanceled';
$this->statuts[0] = 'StatusSendingDraft';
$this->statuts[1] = 'StatusSendingValidated';
@ -1087,7 +1088,7 @@ class Expedition extends CommonObject
$line->volume_units = $obj->volume_units;
// For invoicing
$tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $info_bits, $obj->fk_product_type); // We force type to 0
$tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type); // We force type to 0
$line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements)
$line->qty = $obj->qty_shipped;
$line->total_ht = $tabprice[0];

View File

@ -103,6 +103,8 @@ class ExpeditionLigneBatch extends CommonObject
* @return int <0 if KO, Id of record (>0) if OK
*/
function create($id_line_expdet) {
$error = 0;
$id_line_expdet = (int) $id_line_expdet;
$sql = "INSERT INTO ".MAIN_DB_PREFIX.self::$_table_element." (";

View File

@ -1788,7 +1788,7 @@ function getHelpParamFor($helppagename,$langs)
* @param string $title Title search area
* @param string $htmlmodesearch Value to set into parameter "mode_search" ('soc','contact','products','member',...)
* @param string $htmlinputname Field Name input form
* @return void
* @return string
*/
function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinputname)
{