Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2019-11-13 18:40:33 +01:00
commit edc03a5aeb
4 changed files with 30 additions and 29 deletions

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io> /* Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr> * Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -182,8 +183,8 @@ function showDirectPublicLink($object)
/** /**
* Generate a random id * Generate a random id
* *
* @param string $car Char to generate key * @param int $car Length of string to generate key
* @return void * @return string
*/ */
function generate_random_id($car = 16) function generate_random_id($car = 16)
{ {

View File

@ -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 * \ingroup agenda
* \brief Trigger file for agenda module * \brief Trigger file for company - contactroles
*/ */
require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; 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 class InterfaceContactRoles extends DolibarrTriggers
{ {
public $family = 'agenda'; 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 * Version of the trigger
@ -73,7 +73,6 @@ class InterfaceContactRoles extends DolibarrTriggers
$socid=(property_exists($object, 'socid')?$object->socid:$object->fk_soc); $socid=(property_exists($object, 'socid')?$object->socid:$object->fk_soc);
if (! empty($socid) && $socid > 0) { if (! empty($socid) && $socid > 0) {
global $db, $langs;
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$contactdefault = new Contact($this->db); $contactdefault = new Contact($this->db);
$contactdefault->socid=$socid; $contactdefault->socid=$socid;
@ -83,7 +82,7 @@ class InterfaceContactRoles extends DolibarrTriggers
if ($object->id > 0) if ($object->id > 0)
{ {
$class = get_class($object); $class = get_class($object);
$cloneFrom = new $class($db); $cloneFrom = new $class($this->db);
$r = $cloneFrom->fetch($object->id); $r = $cloneFrom->fetch($object->id);
if (!empty($cloneFrom->id)) $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(-1, 'external'), $cloneFrom->liste_contact(-1, 'internal')); if (!empty($cloneFrom->id)) $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(-1, 'external'), $cloneFrom->liste_contact(-1, 'internal'));

View File

@ -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'); $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF');
if (! in_array($cpt->currency, $arrayzerounitcurrency)) { if (! in_array($cpt->currency, $arrayzerounitcurrency)) {
$currencybalance[$cpt->currency]->available=$cpt->amount / 100; $currencybalance[$cpt->currency]['available']=$cpt->amount / 100;
} else { } 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'); $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF');
if (! in_array($cpt->currency, $arrayzerounitcurrency)) { 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 { } 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) foreach ($currencybalance as $cpt)
{ {
print '<tr><td>'.$langs->trans("Currency".strtoupper($cpt->currency)).'</td><td>'.price($cpt->available, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).'</td><td>'.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).'</td><td>'.price($cpt->available+$cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).'</td></tr>'; print '<tr><td>'.$langs->trans("Currency".strtoupper($cpt['currency'])).'</td><td>'.price($cpt['available'], 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).'</td><td>'.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).'</td><td>'.price($cpt['available']+$cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).'</td></tr>';
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2018 Jean-François Ferry <hello@librethic.io> /* Copyright (C) 2013-2018 Jean-François Ferry <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr> * Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -120,7 +121,7 @@ class Ticket extends CommonObject
public $progress; public $progress;
/** /**
* @var int Duration for ticket * @var string Duration for ticket
*/ */
public $timing; public $timing;
@ -250,11 +251,11 @@ class Ticket extends CommonObject
} }
if (isset($this->fk_soc)) { if (isset($this->fk_soc)) {
$this->fk_soc = trim($this->fk_soc); $this->fk_soc = (int) $this->fk_soc;
} }
if (isset($this->fk_project)) { if (isset($this->fk_project)) {
$this->fk_project = trim($this->fk_project); $this->fk_project = (int) $this->fk_project;
} }
if (isset($this->origin_email)) { if (isset($this->origin_email)) {
@ -262,11 +263,11 @@ class Ticket extends CommonObject
} }
if (isset($this->fk_user_create)) { 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)) { 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)) { if (isset($this->subject)) {
@ -278,7 +279,7 @@ class Ticket extends CommonObject
} }
if (isset($this->fk_statut)) { if (isset($this->fk_statut)) {
$this->fk_statut = trim($this->fk_statut); $this->fk_statut = (int) $this->fk_statut;
} }
if (isset($this->resolution)) { if (isset($this->resolution)) {
@ -746,11 +747,11 @@ class Ticket extends CommonObject
} }
if (isset($this->fk_soc)) { if (isset($this->fk_soc)) {
$this->fk_soc = trim($this->fk_soc); $this->fk_soc = (int) $this->fk_soc;
} }
if (isset($this->fk_project)) { if (isset($this->fk_project)) {
$this->fk_project = trim($this->fk_project); $this->fk_project = (int) $this->fk_project;
} }
if (isset($this->origin_email)) { if (isset($this->origin_email)) {
@ -758,11 +759,11 @@ class Ticket extends CommonObject
} }
if (isset($this->fk_user_create)) { 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)) { 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)) { if (isset($this->subject)) {
@ -774,7 +775,7 @@ class Ticket extends CommonObject
} }
if (isset($this->fk_statut)) { if (isset($this->fk_statut)) {
$this->fk_statut = trim($this->fk_statut); $this->fk_statut = (int) $this->fk_statut;
} }
if (isset($this->resolution)) { if (isset($this->resolution)) {
@ -1002,12 +1003,12 @@ class Ticket extends CommonObject
$this->ref = 'TI0501-001'; $this->ref = 'TI0501-001';
$this->track_id = 'XXXXaaaa'; $this->track_id = 'XXXXaaaa';
$this->origin_email = 'email@email.com'; $this->origin_email = 'email@email.com';
$this->fk_project = '1'; $this->fk_project = 1;
$this->fk_user_create = '1'; $this->fk_user_create = 1;
$this->fk_user_assign = '1'; $this->fk_user_assign = 1;
$this->subject = 'Subject of ticket'; $this->subject = 'Subject of ticket';
$this->message = 'Message of ticket'; $this->message = 'Message of ticket';
$this->fk_statut = '0'; $this->fk_statut = 0;
$this->resolution = '1'; $this->resolution = '1';
$this->progress = '10'; $this->progress = '10';
$this->timing = '30'; $this->timing = '30';