diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 41e783b7597..609dbd9926d 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2016 Christophe Battarel + * Copyright (C) 2019 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -180,10 +181,10 @@ function showDirectPublicLink($object) } /** - * Generate a random id + * Generate a random id * - * @param string $car Char to generate key - * @return void + * @param int $car Length of string to generate key + * @return string */ function generate_random_id($car = 16) { diff --git a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php index b806e70c71d..b50008dba2e 100644 --- a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php +++ b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php @@ -21,9 +21,9 @@ */ /** - * \file htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php + * \file htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php * \ingroup agenda - * \brief Trigger file for agenda module + * \brief Trigger file for company - contactroles */ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; class InterfaceContactRoles extends DolibarrTriggers { public $family = 'agenda'; - public $description = "Triggers of this module add actions in agenda according to setup made in agenda setup."; + public $description = "Triggers of this module auto link contact to company."; /** * Version of the trigger @@ -73,7 +73,6 @@ class InterfaceContactRoles extends DolibarrTriggers $socid=(property_exists($object, 'socid')?$object->socid:$object->fk_soc); if (! empty($socid) && $socid > 0) { - global $db, $langs; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $contactdefault = new Contact($this->db); $contactdefault->socid=$socid; @@ -83,7 +82,7 @@ class InterfaceContactRoles extends DolibarrTriggers if ($object->id > 0) { $class = get_class($object); - $cloneFrom = new $class($db); + $cloneFrom = new $class($this->db); $r = $cloneFrom->fetch($object->id); if (!empty($cloneFrom->id)) $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(-1, 'external'), $cloneFrom->liste_contact(-1, 'internal')); diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 5636f09b3a4..e44feb047ab 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1317,11 +1317,11 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); if (! in_array($cpt->currency, $arrayzerounitcurrency)) { - $currencybalance[$cpt->currency]->available=$cpt->amount / 100; + $currencybalance[$cpt->currency]['available']=$cpt->amount / 100; } else { - $currencybalance[$cpt->currency]->available=$cpt->amount; + $currencybalance[$cpt->currency]['available']=$cpt->amount; } - $currencybalance[$cpt->currency]->currency=$cpt->currency; + $currencybalance[$cpt->currency]['currency']=$cpt->currency; } } @@ -1331,9 +1331,9 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); if (! in_array($cpt->currency, $arrayzerounitcurrency)) { - $currencybalance[$cpt->currency]->pending=$currencybalance[$cpt->currency]->available+$cpt->amount / 100; + $currencybalance[$cpt->currency]['pending']=$currencybalance[$cpt->currency]['available']+$cpt->amount / 100; } else { - $currencybalance[$cpt->currency]->pending=$currencybalance[$cpt->currency]->available+$cpt->amount; + $currencybalance[$cpt->currency]['pending']=$currencybalance[$cpt->currency]['available']+$cpt->amount; } } } @@ -1342,7 +1342,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { foreach ($currencybalance as $cpt) { - print ''.$langs->trans("Currency".strtoupper($cpt->currency)).''.price($cpt->available, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).''.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).''.price($cpt->available+$cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).''; + print ''.$langs->trans("Currency".strtoupper($cpt['currency'])).''.price($cpt['available'], 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''.price($cpt['available']+$cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''; } } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 5784fc22a3e..1d6b1d591c4 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2016 Christophe Battarel + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -120,7 +121,7 @@ class Ticket extends CommonObject public $progress; /** - * @var int Duration for ticket + * @var string Duration for ticket */ public $timing; @@ -250,11 +251,11 @@ class Ticket extends CommonObject } if (isset($this->fk_soc)) { - $this->fk_soc = trim($this->fk_soc); + $this->fk_soc = (int) $this->fk_soc; } if (isset($this->fk_project)) { - $this->fk_project = trim($this->fk_project); + $this->fk_project = (int) $this->fk_project; } if (isset($this->origin_email)) { @@ -262,11 +263,11 @@ class Ticket extends CommonObject } if (isset($this->fk_user_create)) { - $this->fk_user_create = trim($this->fk_user_create); + $this->fk_user_create = (int) $this->fk_user_create; } if (isset($this->fk_user_assign)) { - $this->fk_user_assign = trim($this->fk_user_assign); + $this->fk_user_assign = (int) $this->fk_user_assign; } if (isset($this->subject)) { @@ -278,7 +279,7 @@ class Ticket extends CommonObject } if (isset($this->fk_statut)) { - $this->fk_statut = trim($this->fk_statut); + $this->fk_statut = (int) $this->fk_statut; } if (isset($this->resolution)) { @@ -746,11 +747,11 @@ class Ticket extends CommonObject } if (isset($this->fk_soc)) { - $this->fk_soc = trim($this->fk_soc); + $this->fk_soc = (int) $this->fk_soc; } if (isset($this->fk_project)) { - $this->fk_project = trim($this->fk_project); + $this->fk_project = (int) $this->fk_project; } if (isset($this->origin_email)) { @@ -758,11 +759,11 @@ class Ticket extends CommonObject } if (isset($this->fk_user_create)) { - $this->fk_user_create = trim($this->fk_user_create); + $this->fk_user_create = (int) $this->fk_user_create; } if (isset($this->fk_user_assign)) { - $this->fk_user_assign = trim($this->fk_user_assign); + $this->fk_user_assign = (int) $this->fk_user_assign; } if (isset($this->subject)) { @@ -774,7 +775,7 @@ class Ticket extends CommonObject } if (isset($this->fk_statut)) { - $this->fk_statut = trim($this->fk_statut); + $this->fk_statut = (int) $this->fk_statut; } if (isset($this->resolution)) { @@ -1002,12 +1003,12 @@ class Ticket extends CommonObject $this->ref = 'TI0501-001'; $this->track_id = 'XXXXaaaa'; $this->origin_email = 'email@email.com'; - $this->fk_project = '1'; - $this->fk_user_create = '1'; - $this->fk_user_assign = '1'; + $this->fk_project = 1; + $this->fk_user_create = 1; + $this->fk_user_assign = 1; $this->subject = 'Subject of ticket'; $this->message = 'Message of ticket'; - $this->fk_statut = '0'; + $this->fk_statut = 0; $this->resolution = '1'; $this->progress = '10'; $this->timing = '30';