Fix: project id is lost

This commit is contained in:
Regis Houssin 2010-02-12 09:05:39 +00:00
parent c17d405973
commit 3ab1c569d0
2 changed files with 15 additions and 16 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.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
@ -138,7 +138,7 @@ if ($_POST["action"] == 'add')
$fichinter->socid = $_POST["socid"]; $fichinter->socid = $_POST["socid"];
$fichinter->duree = $_POST["duree"]; $fichinter->duree = $_POST["duree"];
$fichinter->projet_id = $_POST["projetidp"]; $fichinter->project_id = $_POST["projectid"];
$fichinter->author = $user->id; $fichinter->author = $user->id;
$fichinter->description = $_POST["description"]; $fichinter->description = $_POST["description"];
$fichinter->ref = $_POST["ref"]; $fichinter->ref = $_POST["ref"];
@ -170,7 +170,7 @@ if ($_POST["action"] == 'update')
$fichinter = new Fichinter($db); $fichinter = new Fichinter($db);
$fichinter->socid = $_POST["socid"]; $fichinter->socid = $_POST["socid"];
$fichinter->projet_id = $_POST["projetidp"]; $fichinter->project_id = $_POST["projectid"];
$fichinter->author = $user->id; $fichinter->author = $user->id;
$fichinter->description = $_POST["description"]; $fichinter->description = $_POST["description"];
$fichinter->ref = $_POST["ref"]; $fichinter->ref = $_POST["ref"];
@ -212,7 +212,7 @@ if ($_POST['action'] == 'classin')
{ {
$fichinter = new Fichinter($db); $fichinter = new Fichinter($db);
$fichinter->fetch($_GET['id']); $fichinter->fetch($_GET['id']);
$result=$fichinter->setProject($_POST['projetid']); $result=$fichinter->setProject($_POST['projectid']);
if ($result < 0) dol_print_error($db,$fichinter->error); if ($result < 0) dol_print_error($db,$fichinter->error);
} }
@ -453,7 +453,7 @@ if ($_GET["action"] == 'create')
$langs->load("project"); $langs->load("project");
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("Project").'</td><td>';
$numprojet=select_projects($societe->id,$projetid,'projetidp'); $numprojet=select_projects($societe->id,$_POST["projectid"],'projectid');
if ($numprojet==0) if ($numprojet==0)
{ {
print ' &nbsp; <a href="../projet/fiche.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>'; print ' &nbsp; <a href="../projet/fiche.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>';
@ -573,11 +573,11 @@ elseif ($fichinterid)
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($_GET['action'] == 'classin') if ($_GET['action'] == 'classin')
{ {
$html->form_project($_SERVER['PHP_SELF'].'?id='.$fichinter->id, $fichinter->socid, $fichinter->projetidp,'projetid'); $html->form_project($_SERVER['PHP_SELF'].'?id='.$fichinter->id, $fichinter->socid, $fichinter->project_id,'projetid');
} }
else else
{ {
$html->form_project($_SERVER['PHP_SELF'].'?id='.$fichinter->id, $fichinter->socid, $fichinter->projetidp,'none'); $html->form_project($_SERVER['PHP_SELF'].'?id='.$fichinter->id, $fichinter->socid, $fichinter->project_id,'none');
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -622,12 +622,12 @@ elseif ($fichinterid)
/* /*
* Lignes d'intervention * Lignes d'intervention
*/ */
$sql = 'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang'; $sql = 'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang';
$sql.= ', '.$db->pdate('ft.date').' as date_intervention'; $sql.= ', '.$db->pdate('ft.date').' as date_intervention';
$sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; $sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft';
$sql.= ' WHERE ft.fk_fichinter = '.$fichinterid; $sql.= ' WHERE ft.fk_fichinter = '.$fichinterid;
$sql.= ' ORDER BY ft.rang ASC, ft.rowid'; $sql.= ' ORDER BY ft.rang ASC, ft.rowid';
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.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
@ -54,7 +54,7 @@ class Fichinter extends CommonObject
var $description; var $description;
var $note_private; var $note_private;
var $note_public; var $note_public;
var $projet_id; var $project_id;
var $modelpdf; var $modelpdf;
var $lignes = array(); var $lignes = array();
@ -122,7 +122,7 @@ class Fichinter extends CommonObject
$sql.= ", ".$this->author; $sql.= ", ".$this->author;
$sql.= ", '".addslashes($this->description)."'"; $sql.= ", '".addslashes($this->description)."'";
$sql.= ", '".$this->modelpdf."'"; $sql.= ", '".$this->modelpdf."'";
$sql.= ", ".($this->projet_id ? $this->projet_id : 0); $sql.= ", ".($this->project_id ? $this->project_id : 0);
$sql.= ")"; $sql.= ")";
dol_syslog("Fichinter::create sql=".$sql); dol_syslog("Fichinter::create sql=".$sql);
@ -152,9 +152,9 @@ class Fichinter extends CommonObject
global $conf; global $conf;
if (! is_numeric($this->duree)) { $this->duree = 0; } if (! is_numeric($this->duree)) { $this->duree = 0; }
if (! strlen($this->projet_id)) if (! strlen($this->project_id))
{ {
$this->projet_id = 0; $this->project_id = 0;
} }
/* /*
@ -163,7 +163,7 @@ class Fichinter extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET "; $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET ";
$sql.= ", description = '".addslashes($this->description)."'"; $sql.= ", description = '".addslashes($this->description)."'";
$sql.= ", duree = ".$this->duree; $sql.= ", duree = ".$this->duree;
$sql.= ", fk_projet = ".$this->projet_id; $sql.= ", fk_projet = ".$this->project_id;
$sql.= " WHERE rowid = ".$id; $sql.= " WHERE rowid = ".$id;
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
@ -211,8 +211,7 @@ class Fichinter extends CommonObject
$this->datec = $this->db->jdate($obj->datec); $this->datec = $this->db->jdate($obj->datec);
$this->datev = $this->db->jdate($obj->datev); $this->datev = $this->db->jdate($obj->datev);
$this->datem = $this->db->jdate($obj->datem); $this->datem = $this->db->jdate($obj->datem);
$this->projetidp = $obj->fk_projet; $this->project_id = $obj->fk_projet;
$this->projet_id = $obj->fk_projet;
$this->note_public = $obj->note_public; $this->note_public = $obj->note_public;
$this->note_private = $obj->note_private; $this->note_private = $obj->note_private;
$this->modelpdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf;