diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 9a98b389bd0..905bcb8c211 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -6,6 +6,7 @@ * Copyright (C) 2012 Andreu Bisquerra Gaya * Copyright (C) 2012 David Rodriguez Martinez * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2015 Ferran Marcet * * 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 @@ -179,6 +180,7 @@ if (($action == 'create' || $action == 'add') && !$error) $object->origin_id = $orders_id[$ii]; $object->linked_objects = $orders_id; $id = $object->create($user); + $object->fetch_thirdparty(); if ($id>0) { diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 57863100999..45ba9c6a04f 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -95,7 +95,7 @@ class box_project extends ModeleBoxes $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->ref, - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); + 'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid); $this->info_box_contents[$i][2] = array('td' => 'align="left"', 'text' => $objp->title @@ -104,7 +104,7 @@ class box_project extends ModeleBoxes $sql ="SELECT count(*) as nb, sum(progress) as totprogress"; $sql.=" FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."projet_task as pt on pt.fk_projet = p.rowid"; $sql.=" WHERE p.entity = ".$conf->entity; - + $sql.=" AND p.rowid = ".$objp->rowid; $resultTask = $db->query($sql); if ($resultTask) { diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index a1bc1aa215e..f944cb03ab6 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -228,6 +228,45 @@ class modCategorie extends DolibarrModules 'p.note_private' => 'contact', 'p.note_public' => 'contact' ); // We define here only fields that use another picto + + // Add extra fields + $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople'"; + $resql=$this->db->query($sql); + if ($resql) // This can fail when class is used on old database (during migration for example) + { + while ($obj=$this->db->fetch_object($resql)) + { + $fieldname='extra.'.$obj->name; + $fieldlabel=ucfirst($obj->label); + $typeFilter="Text"; + switch($obj->type) + { + case 'int': + case 'double': + case 'price': + $typeFilter="Numeric"; + break; + case 'date': + case 'datetime': + $typeFilter="Date"; + break; + case 'boolean': + $typeFilter="Boolean"; + break; + case 'sellist': + $typeFilter="List:".$obj->param; + break; + case 'select': + $typeFilter="Select:".$obj->param; + break; + } + $this->export_fields_array[$r][$fieldname]=$fieldlabel; + $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; + $this->export_entities_array[$r][$fieldname]='contact'; + } + } + // End add axtra fields + $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p'; $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid';