Merge pull request #8384 from fmarcet/7.0

FIX Activate all also if there are inactive services
This commit is contained in:
Laurent Destailleur 2018-03-15 00:37:37 +01:00 committed by GitHub
commit 14a33af603
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -6,7 +6,7 @@
* Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
@ -2115,7 +2115,7 @@ else
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&amp;socid=' . $object->socid . '&amp;action=clone&amp;object=' . $object->element . '">' . $langs->trans("ToClone") . '</a></div>';
}
if ($object->nbofservicesclosed > 0)
if ($object->nbofservicesclosed > 0 || $object->nbofserviceswait > 0)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=activate">'.$langs->trans("ActivateAllContracts").'</a></div>';
}

View File

@ -11,6 +11,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es.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
@ -180,9 +181,15 @@ if (empty($reshook))
// Merge categories
$static_cat = new Categorie($db);
$custcats = $static_cat->containing($soc_origin->id, 'customer', 'id');
$custcats_ori = $static_cat->containing($soc_origin->id, 'customer', 'id');
$custcats = $static_cat->containing($object->id, 'customer', 'id');
$custcats = array_merge($custcats,$custcats_ori);
$object->setCategories($custcats, 'customer');
$suppcats = $static_cat->containing($soc_origin->id, 'supplier', 'id');
$suppcats_ori = $static_cat->containing($soc_origin->id, 'supplier', 'id');
$suppcats = $static_cat->containing($object->id, 'supplier', 'id');
$suppcats = array_merge($suppcats,$suppcats_ori);
$object->setCategories($suppcats, 'supplier');
// If thirdparty has a new code that is same than origin, we clean origin code to avoid duplicate key from database unique keys.
@ -210,7 +217,7 @@ if (empty($reshook))
$objects = array(
'Adherent' => '/adherents/class/adherent.class.php',
'Societe' => '/societe/class/societe.class.php',
'Categorie' => '/categories/class/categorie.class.php',
//'Categorie' => '/categories/class/categorie.class.php',
'ActionComm' => '/comm/action/class/actioncomm.class.php',
'Propal' => '/comm/propal/class/propal.class.php',
'Commande' => '/commande/class/commande.class.php',