diff --git a/dev/initdata/generate-commande.php b/dev/initdata/generate-commande.php
index 21efafc8199..253d260fc43 100644
--- a/dev/initdata/generate-commande.php
+++ b/dev/initdata/generate-commande.php
@@ -160,7 +160,7 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++)
$com->date_commande = $dates[rand(1, sizeof($dates)-1)];
$com->note = $_POST["note"];
$com->source = 1;
- $com->projetid = 0;
+ $com->fk_project = 0;
$com->remise_percent = 0;
$nbp = rand(2, 5);
diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php
index cc8b6194ab5..dc67576c037 100644
--- a/htdocs/comm/action/fiche.php
+++ b/htdocs/comm/action/fiche.php
@@ -496,8 +496,8 @@ if ($_GET["action"] == 'create')
$langs->load("project");
print '
| '.$langs->trans("Project").' | ';
- $numprojet=select_projects($societe->id,$_REQUEST["projectid"]?$_REQUEST["projectid"]:$projetid,'projectid');
- if ($numprojet==0)
+ $numproject=select_projects($societe->id,$_REQUEST["projectid"]?$_REQUEST["projectid"]:$projectid,'projectid');
+ if ($numproject==0)
{
print ' '.$langs->trans("AddProject").'';
}
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 1e4cf62fa9e..715c8ddf6ef 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -238,23 +238,23 @@ if ($_POST['action'] == 'add' && $user->rights->propale->creer)
{
if ($propal->fetch($_POST['copie_propal']) > 0)
{
- $propal->ref = $_POST['ref'];
- $propal->datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
- $propal->date_livraison = dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']);
- $propal->fk_delivery_address = $_POST['adresse_livraison_id'];
- $propal->adresse_livraison_id = $_POST['adresse_livraison_id']; // TODO obsolete
- $propal->duree_validite = $_POST['duree_validite'];
- $propal->cond_reglement_id = $_POST['cond_reglement_id'];
- $propal->mode_reglement_id = $_POST['mode_reglement_id'];
- $propal->remise_percent = $_POST['remise_percent'];
- $propal->remise_absolue = $_POST['remise_absolue'];
- $propal->socid = $_POST['socid'];
- $propal->contactid = $_POST['contactidp'];
- $propal->projectid = $_POST['projectid'];
- $propal->modelpdf = $_POST['model'];
- $propal->author = $user->id; // deprecated
- $propal->note = $_POST['note'];
- $propal->statut = 0;
+ $propal->ref = $_POST['ref'];
+ $propal->datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
+ $propal->date_livraison = dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']);
+ $propal->fk_delivery_address = $_POST['adresse_livraison_id'];
+ $propal->adresse_livraison_id = $_POST['adresse_livraison_id']; // TODO obsolete
+ $propal->duree_validite = $_POST['duree_validite'];
+ $propal->cond_reglement_id = $_POST['cond_reglement_id'];
+ $propal->mode_reglement_id = $_POST['mode_reglement_id'];
+ $propal->remise_percent = $_POST['remise_percent'];
+ $propal->remise_absolue = $_POST['remise_absolue'];
+ $propal->socid = $_POST['socid'];
+ $propal->contactid = $_POST['contactidp'];
+ $propal->fk_project = $_POST['projectid'];
+ $propal->modelpdf = $_POST['model'];
+ $propal->author = $user->id; // deprecated
+ $propal->note = $_POST['note'];
+ $propal->statut = 0;
$id = $propal->create_from($user);
}
@@ -276,7 +276,7 @@ if ($_POST['action'] == 'add' && $user->rights->propale->creer)
$propal->mode_reglement_id = $_POST['mode_reglement_id'];
$propal->contactid = $_POST['contactidp'];
- $propal->projectid = $_POST['projectid'];
+ $propal->fk_project = $_POST['projectid'];
$propal->modelpdf = $_POST['model'];
$propal->author = $user->id; // deprecated
$propal->note = $_POST['note'];
@@ -898,7 +898,7 @@ if ($_POST['action'] == 'classin')
{
$propal = new Propal($db);
$propal->fetch($_GET['propalid']);
- $propal->setProject($_POST['projetidp']);
+ $propal->setProject($_POST['projectid']);
}
// Conditions de reglement
@@ -1325,23 +1325,23 @@ if ($id > 0 || ! empty($ref))
print ' | ';
if ($_GET['action'] == 'classer')
{
- $html->form_project($_SERVER['PHP_SELF'].'?propalid='.$propal->id, $propal->socid, $propal->projetidp, 'projetidp');
+ $html->form_project($_SERVER['PHP_SELF'].'?propalid='.$propal->id, $propal->socid, $propal->fk_project, 'projectid');
}
else
{
- $html->form_project($_SERVER['PHP_SELF'].'?propalid='.$propal->id, $propal->socid, $propal->projetidp, 'none');
+ $html->form_project($_SERVER['PHP_SELF'].'?propalid='.$propal->id, $propal->socid, $propal->fk_project, 'none');
}
print ' |
';
}
else
{
print '';
- if (!empty($propal->projetidp))
+ if (!empty($propal->fk_project))
{
print '';
$proj = new Project($db);
- $proj->fetch($propal->projetidp);
- print '';
+ $proj->fetch($propal->fk_project);
+ print '';
print $proj->ref;
print '';
print ' | ';
diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php
index 1dedf3dafd3..c197c78ce87 100644
--- a/htdocs/commande/commande.class.php
+++ b/htdocs/commande/commande.class.php
@@ -52,7 +52,7 @@ class Commande extends CommonObject
var $ref;
var $ref_client;
var $contactid;
- var $projet_id;
+ var $fk_project;
var $statut; // -1=Annulee, 0=Brouillon, 1=Validee, 2=Acceptee, 3=Envoyee/Recue (facturee ou non)
var $facturee; // Facturee ou non
var $brouillon;
@@ -139,7 +139,7 @@ class Commande extends CommonObject
}
$this->socid = $propal->socid;
- $this->projetid = $propal->projetidp;
+ $this->fk_project = $propal->fk_project;
$this->cond_reglement_id = $propal->cond_reglement_id;
$this->mode_reglement_id = $propal->mode_reglement_id;
$this->date_livraison = $propal->date_livraison;
@@ -539,7 +539,7 @@ class Commande extends CommonObject
return -1;
}
if (! $remise) $remise=0;
- if (! $this->projetid) $this->projetid = 0;
+ if (! $this->fk_project) $this->fk_project = 0;
$this->db->begin();
@@ -550,7 +550,7 @@ class Commande extends CommonObject
$sql.= ", remise_absolue, remise_percent";
$sql.= ", entity";
$sql.= ")";
- $sql.= " VALUES ('(PROV)',".$this->socid.", ".$this->db->idate(gmmktime()).", ".$user->id.", ".$this->projetid;
+ $sql.= " VALUES ('(PROV)',".$this->socid.", ".$this->db->idate(gmmktime()).", ".$user->id.", ".$this->fk_project;
$sql.= ", ".$this->db->idate($this->date_commande);
$sql.= ", ".($this->source>=0 && $this->source != '' ?$this->source:'null');
$sql.= ", '".addslashes($this->note)."'";
@@ -979,7 +979,6 @@ class Commande extends CommonObject
$this->facturee = $obj->facturee;
$this->note = $obj->note;
$this->note_public = $obj->note_public;
- $this->projet_id = $obj->fk_projet; // TODO deprecated
$this->fk_project = $obj->fk_projet;
$this->modelpdf = $obj->model_pdf;
$this->mode_reglement_id = $obj->fk_mode_reglement;
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 283aafe0107..509a563cb80 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -58,7 +58,6 @@ $result=restrictedArea($user,'commande',$comid,'');
$usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
$mesg=isset($_GET['mesg'])?$_GET['mesg']:'';
-$projetid=isset($_GET['projetid'])?$_GET['projetid']:0;
/******************************************************************************/
@@ -150,7 +149,7 @@ if ($_POST['action'] == 'classin')
{
$commande = new Commande($db);
$commande->fetch($_GET['id']);
- $commande->setProject($_POST['projetid']);
+ $commande->setProject($_POST['projectid']);
}
// Add order
@@ -170,7 +169,7 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
$commande->note = $_POST['note'];
$commande->note_public = $_POST['note_public'];
$commande->source = $_POST['source_id'];
- $commande->projetid = $_POST['projetid'];
+ $commande->fk_project = $_POST['projectid'];
$commande->ref_client = $_POST['ref_client'];
$commande->modelpdf = $_POST['model'];
$commande->cond_reglement_id = $_POST['cond_reglement_id'];
@@ -1043,6 +1042,12 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
print '' ."\n";
print '';
print '';
+
+ if (isset($_GET["origin"]) && $_GET["origin"] != 'project' && isset($_GET["originid"]))
+ {
+ print '';
+ print '';
+ }
print '';
@@ -1116,9 +1121,11 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
// Projet
if ($conf->projet->enabled)
{
- $projetid=$_POST["projetid"]?$_POST["projetid"]:$commande->projetid;
+ $projectid = 0;
+ if (isset($_GET["origin"]) && $_GET["origin"] == 'project') $projectid = ($_GET["originid"]?$_GET["originid"]:0);
+
print '| '.$langs->trans('Project').' | ';
- $numprojet=select_projects($soc->id,$projetid,'projetid');
+ $numprojet=select_projects($soc->id,$projectid);
if ($numprojet==0)
{
print ' '.$langs->trans("AddProject").'';
@@ -1603,11 +1610,11 @@ else
print ' | ';
if ($_GET['action'] == 'classer')
{
- $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->projet_id, 'projetid');
+ $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->fk_project, 'projectid');
}
else
{
- $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->projet_id, 'none');
+ $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->fk_project, 'none');
}
print ' |
';
}
diff --git a/htdocs/commonobject.class.php b/htdocs/commonobject.class.php
index 4c9c74781b6..89e87ca5259 100644
--- a/htdocs/commonobject.class.php
+++ b/htdocs/commonobject.class.php
@@ -365,14 +365,14 @@ class CommonObject
}
/**
- * \brief Charge le projet d'id $this->projet_id dans this->projet
+ * \brief Charge le projet d'id $this->fk_project dans this->projet
* \return int <0 if KO, >0 if OK
*/
function fetch_projet()
{
- $projet = new Project($this->db);
- $result=$projet->fetch($this->projet_id);
- $this->projet = $projet;
+ $project = new Project($this->db);
+ $result = $project->fetch($this->fk_project);
+ $this->projet = $project;
return $result;
}
@@ -508,7 +508,7 @@ class CommonObject
* \param projid Project id to link element to
* \return int <0 if KO, >0 if OK
*/
- function setProject($projid)
+ function setProject($projectid)
{
if (! $this->table_element)
{
@@ -517,16 +517,14 @@ class CommonObject
}
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
- if ($projid) $sql.= ' SET fk_projet = '.$projid;
+ if ($projectid) $sql.= ' SET fk_projet = '.$projectid;
else $sql.= ' SET fk_projet = NULL';
$sql.= ' WHERE rowid = '.$this->id;
dol_syslog("CommonObject::setProject sql=".$sql);
if ($this->db->query($sql))
{
- $this->project_id=$projid;
- $this->projet_id=$projid;
- $this->projetidp=$projid;
+ $this->fk_project = $projectid;
return 1;
}
else
diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php
index be2ceb67bfa..4585c267b74 100644
--- a/htdocs/compta/commande/fiche.php
+++ b/htdocs/compta/commande/fiche.php
@@ -59,7 +59,7 @@ if ($_POST['action'] == 'classin')
{
$commande = new Commande($db);
$commande->fetch($_GET['id']);
- $commande->setProject($_POST['projetid']);
+ $commande->setProject($_POST['projectid']);
}
if ($_GET["action"] == 'facturee')
@@ -331,11 +331,11 @@ if ($id > 0 || ! empty($ref))
print '';
if ($_GET['action'] == 'classer')
{
- $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->projet_id, 'projetid');
+ $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->fk_project, 'projectid');
}
else
{
- $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->projet_id, 'none');
+ $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->fk_project, 'none');
}
print ' | ';
}
diff --git a/htdocs/compta/dons/fiche.php b/htdocs/compta/dons/fiche.php
index 2fe29c078c8..ba6c7cd8682 100644
--- a/htdocs/compta/dons/fiche.php
+++ b/htdocs/compta/dons/fiche.php
@@ -80,7 +80,7 @@ if ($_POST["action"] == 'update')
$don->note = $_POST["note"];
$don->pays = $_POST["pays"];
$don->public = $_POST["public"];
- $don->projetid = $_POST["projetid"];
+ $don->fk_project = $_POST["projectid"];
$don->note = $_POST["comment"];
$don->modepaiementid = $_POST["modepaiement"];
@@ -124,7 +124,7 @@ if ($_POST["action"] == 'add')
$don->note = $_POST["note"];
$don->pays = $_POST["pays"];
$don->public = $_POST["public"];
- $don->projetid = $_POST["projetid"];
+ $don->fk_project = $_POST["projectid"];
$don->note = $_POST["comment"];
$don->modepaiementid = $_POST["modepaiement"];
@@ -256,7 +256,7 @@ if ($_GET["action"] == 'create')
{
// Si module projet actif
print "| ".$langs->trans("Project")." | ";
- select_projects('',$_POST["projetid"],"projetid");
+ select_projects('',$_POST["projectid"],"projectid");
print " |
\n";
}
@@ -327,7 +327,7 @@ if ($_GET["rowid"] && $_GET["action"] == 'edit')
{
$langs->load('projects');
print '| '.$langs->trans('Project').' | ';
- select_projects($soc->id, isset($_POST["projetid"])?$_POST["projetid"]:$don->projetid, 'projetid');
+ select_projects($soc->id, isset($_POST["projectid"])?$_POST["projectid"]:$don->fk_project, 'projectid');
print ' |
';
}
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index bbb7a164e07..16449550d6c 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -49,7 +49,7 @@ $langs->load('main');
$sall=isset($_GET['sall'])?trim($_GET['sall']):trim($_POST['sall']);
$mesg=isset($_GET['mesg'])?$_GET['mesg']:'';
-$projetid=isset($_GET['projetid'])?$_GET['projetid']:0;
+$projectid=isset($_GET['projectid'])?$_GET['projectid']:0;
// Security check
$socid=isset($_GET['socid'])?$_GET['socid']:$_POST['socid'];
@@ -215,7 +215,7 @@ if ($_POST['action'] == 'classin')
{
$facture = new Facture($db);
$facture->fetch($_GET['facid']);
- $facture->setProject($_POST['projetid']);
+ $facture->setProject($_POST['projectid']);
}
if ($_POST['action'] == 'setmode')
@@ -536,7 +536,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
$facture->note = trim($_POST['note']);
$facture->ref_client = $_POST['ref_client'];
$facture->modelpdf = $_POST['model'];
- $facture->projetid = $_POST['projetid'];
+ $facture->fk_project = $_POST['projectid'];
$facture->cond_reglement_id = $_POST['cond_reglement_id'];
$facture->mode_reglement_id = $_POST['mode_reglement_id'];
$facture->remise_absolue = $_POST['remise_absolue'];
@@ -580,7 +580,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
$facture->note = trim($_POST['note']);
$facture->ref_client = $_POST['ref_client'];
$facture->modelpdf = $_POST['model'];
- $facture->projetid = $_POST['projetid'];
+ $facture->fk_project = $_POST['projectid'];
$facture->cond_reglement_id = 0;
$facture->mode_reglement_id = $_POST['mode_reglement_id'];
$facture->remise_absolue = $_POST['remise_absolue'];
@@ -657,7 +657,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
$facture->note = trim($_POST['note']);
$facture->ref_client = $_POST['ref_client'];
$facture->modelpdf = $_POST['model'];
- $facture->projetid = $_POST['projetid'];
+ $facture->fk_project = $_POST['projectid'];
$facture->cond_reglement_id = ($_POST['type'] == 3?1:$_POST['cond_reglement_id']);
$facture->mode_reglement_id = $_POST['mode_reglement_id'];
$facture->amount = $_POST['amount'];
@@ -1494,7 +1494,7 @@ if ($_GET['action'] == 'create')
$propal->fetch($_GET['propalid']);
$propal->fetch_client();
- $projetid=$propal->projetidp;
+ $projectid=$propal->fk_project;
$ref_client=$propal->ref_client;
$soc=$propal->client;
@@ -1509,7 +1509,7 @@ if ($_GET['action'] == 'create')
$commande->fetch($_GET['commandeid']);
$commande->fetch_client();
- $projetid=$commande->projet_id;
+ $projectid=$commande->fk_project;
$ref_client=$commande->ref_client;
$soc=$commande->client;
@@ -1524,7 +1524,7 @@ if ($_GET['action'] == 'create')
$contrat->fetch($_GET['contratid']);
$contrat->fetch_client();
- $projetid=$contrat->fk_projet;
+ $projectid=$contrat->fk_project;
$soc=$contrat->client;
$cond_reglement_id = $soc->cond_reglement;
@@ -1760,7 +1760,7 @@ if ($_GET['action'] == 'create')
{
$langs->load('projects');
print '| '.$langs->trans('Project').' | ';
- select_projects($soc->id, $projetid, 'projetid');
+ select_projects($soc->id, $projectid, 'projectid');
print ' |
';
}
@@ -2828,11 +2828,11 @@ else
print '';
if ($_GET['action'] == 'classin')
{
- $html->form_project($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->socid,$fac->projetid,'projetid');
+ $html->form_project($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->socid,$fac->fk_project,'projectid');
}
else
{
- $html->form_project($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->socid,$fac->projetid,'none');
+ $html->form_project($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->socid,$fac->fk_project,'none');
}
print ' | ';
print '';
diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php
index 18827516a70..723538c7327 100644
--- a/htdocs/compta/facture/apercu.php
+++ b/htdocs/compta/facture/apercu.php
@@ -234,11 +234,11 @@ if ($_GET["facid"] > 0)
$langs->load("projects");
print '';
print '| '.$langs->trans("Project").' | ';
- if ($fac->projetid > 0)
+ if ($fac->fk_project > 0)
{
- $projet = New Project($db);
- $projet->fetch($fac->projetid);
- print ''.$projet->title.'';
+ $project = New Project($db);
+ $project->fetch($fac->fk_project);
+ print ''.$project->title.'';
}
else
{
diff --git a/htdocs/compta/facture/facture-rec.class.php b/htdocs/compta/facture/facture-rec.class.php
index 96513d50b80..d31e561b6f6 100644
--- a/htdocs/compta/facture/facture-rec.class.php
+++ b/htdocs/compta/facture/facture-rec.class.php
@@ -60,7 +60,7 @@ class FactureRec extends Facture
var $note;
var $db_table;
var $propalid;
- var $projetid;
+ var $fk_project;
/**
@@ -123,7 +123,7 @@ class FactureRec extends Facture
$sql.= ", '".$facsrc->remise."'";
$sql.= ", '".addslashes($this->note)."'";
$sql.= ", '".$user->id."'";
- $sql.= ", ".($facsrc->projetid?"'".$facsrc->projetid."'":"null");
+ $sql.= ", ".($facsrc->fk_project?"'".$facsrc->fk_project."'":"null");
$sql.= ", '".$facsrc->cond_reglement_id."'";
$sql.= ", '".$facsrc->mode_reglement_id."'";
$sql.= ")";
@@ -238,7 +238,7 @@ class FactureRec extends Facture
$this->cond_reglement_code = $obj->cond_reglement_code;
$this->cond_reglement = $obj->cond_reglement_libelle;
$this->cond_reglement_doc = $obj->cond_reglement_libelle_doc;
- $this->projetid = $obj->fk_projet;
+ $this->fk_project = $obj->fk_projet;
$this->fk_facture_source = $obj->fk_facture_source;
$this->note = $obj->note;
$this->note_public = $obj->note_public;
diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php
index b61e6c73054..8d1a08f4d5d 100644
--- a/htdocs/compta/facture/fiche-rec.php
+++ b/htdocs/compta/facture/fiche-rec.php
@@ -144,11 +144,11 @@ if ($_GET["action"] == 'create')
if ($conf->projet->enabled)
{
print " |
| ".$langs->trans("Project")." | ";
- if ($facture->projetid > 0)
+ if ($facture->fk_project > 0)
{
- $proj = new Project($db);
- $proj->fetch($facture->projetid);
- print $proj->title;
+ $project = new Project($db);
+ $project->fetch($facture->fk_project);
+ print $project->title;
}
print " |
";
}
diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php
index b7238519e7b..2af4102bdb5 100644
--- a/htdocs/compta/propal.php
+++ b/htdocs/compta/propal.php
@@ -112,7 +112,7 @@ if ($_POST['action'] == 'classin')
{
$propal = new Propal($db);
$propal->fetch($_GET['propalid']);
- $propal->setProject($_POST['projetidp']);
+ $propal->setProject($_POST['projectid']);
}
@@ -267,28 +267,29 @@ if ($id > 0 || ! empty($ref))
print '';
if ($_GET['action'] == 'classer')
{
- $html->form_project($_SERVER['PHP_SELF'].'?propalid='.$propal->id, $propal->socid, $propal->projetidp, 'projetidp');
+ $html->form_project($_SERVER['PHP_SELF'].'?propalid='.$propal->id, $propal->socid, $propal->fk_project, 'projectid');
}
else
{
- $html->form_project($_SERVER['PHP_SELF'].'?propalid='.$propal->id, $propal->socid, $propal->projetidp, 'none');
+ $html->form_project($_SERVER['PHP_SELF'].'?propalid='.$propal->id, $propal->socid, $propal->fk_project, 'none');
}
print ' | ';
}
else
{
print '
';
- if (!empty($propal->projetidp))
+ if (!empty($propal->fk_project))
{
print '';
- $proj = new Project($db);
- $proj->fetch($propal->projetidp);
- print '';
- print $proj->ref;
+ $project = new Project($db);
+ $project->fetch($propal->fk_project);
+ print '';
+ print $project->ref;
print '';
print ' | ';
}
- else {
+ else
+ {
print ' | ';
}
}
diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php
index 848ac1bcb1a..77b6f8c578c 100644
--- a/htdocs/contrat/fiche.php
+++ b/htdocs/contrat/fiche.php
@@ -152,7 +152,7 @@ if ($_POST["action"] == 'add')
$contrat->commercial_signature_id = $_POST["commercial_signature_id"];
$contrat->note = trim($_POST["note"]);
- $contrat->fk_projet = trim($_POST["projetid"]);
+ $contrat->fk_project = trim($_POST["projectid"]);
$contrat->remise_percent = trim($_POST["remise_percent"]);
$contrat->ref = trim($_POST["ref"]);
@@ -174,7 +174,7 @@ if ($_POST["action"] == 'classin')
{
$contrat = new Contrat($db);
$contrat->fetch($_GET["id"]);
- $contrat->setProject($_POST["projetid"]);
+ $contrat->setProject($_POST["projectid"]);
}
if ($_POST["action"] == 'addligne' && $user->rights->contrat->creer)
@@ -514,9 +514,9 @@ if ($_GET["action"] == 'create')
if ($conf->projet->enabled)
{
print '| '.$langs->trans("Project").' | ';
- select_projects($soc->id,$_REQUEST["projetid"],"projetid");
- //$proj = new Project($db);
- //$form->select_array("projetid",$proj->liste_array($soc->id),$_REQUEST["projetid"],1);
+ select_projects($soc->id,$_REQUEST["projectid"],"projectid");
+ //$project = new Project($db);
+ //$form->select_array("projectid",$project->liste_array($soc->id),$_REQUEST["projectid"],1);
print " |
";
}
@@ -750,11 +750,11 @@ else
print '';
if ($_GET["action"] == "classer")
{
- $form->form_project("fiche.php?id=$id",$contrat->socid,$contrat->fk_projet,"projetid");
+ $form->form_project("fiche.php?id=$id",$contrat->socid,$contrat->fk_project,"projectid");
}
else
{
- $form->form_project("fiche.php?id=$id",$contrat->socid,$contrat->fk_projet,"none");
+ $form->form_project("fiche.php?id=$id",$contrat->socid,$contrat->fk_project,"none");
}
print " | ";
}
diff --git a/htdocs/don.class.php b/htdocs/don.class.php
index 6de6cd53d54..3617f8621e1 100644
--- a/htdocs/don.class.php
+++ b/htdocs/don.class.php
@@ -51,7 +51,7 @@ class Don extends CommonObject
var $pays;
var $email;
var $public;
- var $projetid;
+ var $fk_project;
var $modepaiement;
var $modepaiementid;
var $note;
@@ -329,7 +329,7 @@ class Don extends CommonObject
$sql.= ", '".addslashes($this->ville)."'";
$sql.= ", '".addslashes($this->pays)."'"; // TODO use fk_pays
$sql.= ", ".$this->public;
- $sql.= ", ".($this->projetid > 0?$this->projetid:"null");
+ $sql.= ", ".($this->fk_project > 0?$this->fk_project:"null");
$sql.= ", '".addslashes($this->note)."'";
$sql.= ", ".$user->id;
$sql.= ", null";
@@ -371,7 +371,7 @@ class Don extends CommonObject
$sql .= ",ville='".addslashes($this->ville)."'";
$sql .= ",pays='".addslashes($this->pays)."'"; // TODO use fk_pays
$sql .= ",public=".$this->public;
- $sql .= ",fk_don_projet=".($this->projetid>0?$this->projetid:'null');
+ $sql .= ",fk_don_projet=".($this->fk_project>0?$this->fk_project:'null');
$sql .= ",note='".addslashes($this->note)."'";
$sql .= ",datedon='".$this->date."'";
$sql .= ",email='".$this->email."'";
@@ -429,7 +429,7 @@ class Don extends CommonObject
$sql = "SELECT d.rowid, d.datec,";
$sql.= " d.datedon,";
$sql.= " d.prenom, d.nom, d.societe, d.amount, d.fk_statut, d.adresse, d.cp, d.ville, d.pays, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email, d.fk_don_projet,";
- $sql.= " p.title as projet";
+ $sql.= " p.title as project_label";
$sql.= " FROM ".MAIN_DB_PREFIX."c_paiement as cp, ".MAIN_DB_PREFIX."don as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p";
$sql.= " ON p.rowid = d.fk_don_projet";
@@ -456,8 +456,8 @@ class Don extends CommonObject
$this->ville = $obj->ville;
$this->email = $obj->email;
$this->pays = $obj->pays;
- $this->projet = $obj->projet;
- $this->projetid = $obj->fk_don_projet;
+ $this->projet = $obj->project_label;
+ $this->fk_project = $obj->fk_don_projet;
$this->public = $obj->public;
$this->modepaiementid = $obj->fk_paiement;
$this->modepaiement = $obj->libelle;
diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php
index 01c82b0a086..990961e702e 100644
--- a/htdocs/expedition/shipment.php
+++ b/htdocs/expedition/shipment.php
@@ -64,7 +64,7 @@ if ($_POST['action'] == 'classin')
{
$commande = new Commande($db);
$commande->fetch($_GET['id']);
- $commande->setProject($_POST['projetid']);
+ $commande->setProject($_POST['projectid']);
}
if ($_POST["action"] == 'confirm_cloture' && $_POST["confirm"] == 'yes')
@@ -349,11 +349,11 @@ if ($id > 0 || ! empty($ref))
print '';
if ($_GET['action'] == 'classer')
{
- $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->projet_id, 'projetid');
+ $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->fk_project, 'projectid');
}
else
{
- $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->projet_id, 'none');
+ $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->fk_project, 'none');
}
print ' | ';
}
diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php
index 8c553b63d03..db809782fa5 100644
--- a/htdocs/facture.class.php
+++ b/htdocs/facture.class.php
@@ -89,7 +89,7 @@ class Facture extends CommonObject
//! Commentaire si mis a paye sans paiement complet
var $close_note;
var $propalid;
- var $projetid;
+ var $fk_project;
var $date_lim_reglement;
var $cond_reglement_id; // Id in llx_cond_reglement
var $cond_reglement_code; // Code in llx_cond_reglement
@@ -125,7 +125,7 @@ class Facture extends CommonObject
$this->total_tva = 0;
$this->total_ttc = 0;
$this->propalid = 0;
- $this->projetid = 0;
+ $this->fk_project = 0;
$this->remise_exceptionnelle = 0;
}
@@ -173,7 +173,7 @@ class Facture extends CommonObject
$_facrec = new FactureRec($this->db);
$result=$_facrec->fetch($this->fac_rec);
- $this->projetid = $_facrec->projetid;
+ $this->fk_project = $_facrec->fk_project;
$this->cond_reglement = $_facrec->cond_reglement_id;
$this->cond_reglement_id = $_facrec->cond_reglement_id;
$this->mode_reglement = $_facrec->mode_reglement_id;
@@ -234,7 +234,7 @@ class Facture extends CommonObject
$sql.= ",".($this->ref_client?"'".addslashes($this->ref_client)."'":"null");
$sql.= ",".($this->fk_facture_source?"'".addslashes($this->fk_facture_source)."'":"null");
$sql.= ",".($user->id > 0 ? "'".$user->id."'":"null");
- $sql.= ",".($this->projetid?$this->projetid:"null");
+ $sql.= ",".($this->fk_project?$this->fk_project:"null");
$sql.= ','.$this->cond_reglement_id;
$sql.= ",".$this->mode_reglement_id;
$sql.= ",".$this->db->idate($datelim).", '".$this->modelpdf."')";
@@ -390,7 +390,7 @@ class Facture extends CommonObject
$facture->note = $this->note;
$facture->ref_client = $this->ref_client;
$facture->modelpdf = $this->modelpdf;
- $facture->projetid = $this->projetid;
+ $facture->fk_project = $this->fk_project;
$facture->cond_reglement_id = $this->cond_reglement_id;
$facture->mode_reglement_id = $this->mode_reglement_id;
$facture->amount = $this->amount;
@@ -600,7 +600,7 @@ class Facture extends CommonObject
$this->cond_reglement_code = $obj->cond_reglement_code;
$this->cond_reglement = $obj->cond_reglement_libelle;
$this->cond_reglement_doc = $obj->cond_reglement_libelle_doc;
- $this->projetid = $obj->fk_projet;
+ $this->fk_project = $obj->fk_projet;
$this->fk_facture_source = $obj->fk_facture_source;
$this->note = $obj->note;
$this->note_public = $obj->note_public;
@@ -760,7 +760,7 @@ class Facture extends CommonObject
if (isset($this->user_author)) $this->user_author=trim($this->user_author);
if (isset($this->fk_user_valid)) $this->fk_user_valid=trim($this->fk_user_valid);
if (isset($this->fk_facture_source)) $this->fk_facture_source=trim($this->fk_facture_source);
- if (isset($this->projetid)) $this->projetid=trim($this->projetid);
+ if (isset($this->fk_project)) $this->fk_project=trim($this->fk_project);
if (isset($this->cond_reglement_id)) $this->cond_reglement_id=trim($this->cond_reglement_id);
if (isset($this->mode_reglement_id)) $this->mode_reglement_id=trim($this->mode_reglement_id);
if (isset($this->note)) $this->note=trim($this->note);
@@ -796,7 +796,7 @@ class Facture extends CommonObject
$sql.= " fk_user_author=".(isset($this->user_author)?$this->user_author:"null").",";
$sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->fk_user_valid:"null").",";
$sql.= " fk_facture_source=".(isset($this->fk_facture_source)?$this->fk_facture_source:"null").",";
- $sql.= " fk_projet=".(isset($this->projetid)?$this->projetid:"null").",";
+ $sql.= " fk_projet=".(isset($this->fk_project)?$this->fk_project:"null").",";
$sql.= " fk_cond_reglement=".(isset($this->cond_reglement_id)?$this->cond_reglement_id:"null").",";
$sql.= " fk_mode_reglement=".(isset($this->mode_reglement_id)?$this->mode_reglement_id:"null").",";
$sql.= " date_lim_reglement=".(strval($this->date_lim_reglement)!='' ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'null').",";
diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php
index 43c134d3996..a5aef4a75f6 100644
--- a/htdocs/fichinter/fiche.php
+++ b/htdocs/fichinter/fiche.php
@@ -144,13 +144,13 @@ if ($_POST["action"] == 'add')
{
$fichinter = new Fichinter($db);
- $fichinter->socid = $_POST["socid"];
- $fichinter->duree = $_POST["duree"];
- $fichinter->project_id = $_POST["projectid"];
- $fichinter->author = $user->id;
+ $fichinter->socid = $_POST["socid"];
+ $fichinter->duree = $_POST["duree"];
+ $fichinter->fk_project = $_POST["projectid"];
+ $fichinter->author = $user->id;
$fichinter->description = $_POST["description"];
- $fichinter->ref = $_POST["ref"];
- $fichinter->modelpdf = $_POST["model"];
+ $fichinter->ref = $_POST["ref"];
+ $fichinter->modelpdf = $_POST["model"];
if ($fichinter->socid > 0)
{
@@ -177,11 +177,11 @@ if ($_POST["action"] == 'update')
{
$fichinter = new Fichinter($db);
- $fichinter->socid = $_POST["socid"];
- $fichinter->project_id = $_POST["projectid"];
- $fichinter->author = $user->id;
+ $fichinter->socid = $_POST["socid"];
+ $fichinter->fk_project = $_POST["projectid"];
+ $fichinter->author = $user->id;
$fichinter->description = $_POST["description"];
- $fichinter->ref = $_POST["ref"];
+ $fichinter->ref = $_POST["ref"];
$fichinter->update($_POST["id"]);
$_GET["id"]=$_POST["id"]; // Force raffraichissement sur fiche venant d'etre creee
@@ -615,11 +615,11 @@ elseif ($fichinterid)
print '';
if ($_GET['action'] == 'classin')
{
- $html->form_project($_SERVER['PHP_SELF'].'?id='.$fichinter->id, $fichinter->socid, $fichinter->project_id,'projectid');
+ $html->form_project($_SERVER['PHP_SELF'].'?id='.$fichinter->id, $fichinter->socid, $fichinter->fk_project,'projectid');
}
else
{
- $html->form_project($_SERVER['PHP_SELF'].'?id='.$fichinter->id, $fichinter->socid, $fichinter->project_id,'none');
+ $html->form_project($_SERVER['PHP_SELF'].'?id='.$fichinter->id, $fichinter->socid, $fichinter->fk_project,'none');
}
print ' | ';
print '';
diff --git a/htdocs/fichinter/fichinter.class.php b/htdocs/fichinter/fichinter.class.php
index 58a476a7397..594334b8acc 100644
--- a/htdocs/fichinter/fichinter.class.php
+++ b/htdocs/fichinter/fichinter.class.php
@@ -54,7 +54,7 @@ class Fichinter extends CommonObject
var $description;
var $note_private;
var $note_public;
- var $project_id;
+ var $fk_project;
var $modelpdf;
var $lignes = array();
@@ -69,7 +69,7 @@ class Fichinter extends CommonObject
$this->db = $DB ;
$this->socid = $socid;
$this->products = array();
- $this->projet_id = 0;
+ $this->fk_project = 0;
// List of language codes for status
$this->statuts[0]='Draft';
@@ -122,7 +122,7 @@ class Fichinter extends CommonObject
$sql.= ", ".$this->author;
$sql.= ", '".addslashes($this->description)."'";
$sql.= ", '".$this->modelpdf."'";
- $sql.= ", ".($this->project_id ? $this->project_id : 0);
+ $sql.= ", ".($this->fk_project ? $this->fk_project : 0);
$sql.= ")";
dol_syslog("Fichinter::create sql=".$sql);
@@ -152,10 +152,7 @@ class Fichinter extends CommonObject
global $conf;
if (! is_numeric($this->duree)) { $this->duree = 0; }
- if (! strlen($this->project_id))
- {
- $this->project_id = 0;
- }
+ if (! strlen($this->fk_project)) { $this->fk_project = 0; }
/*
* Insertion dans la base
@@ -163,7 +160,7 @@ class Fichinter extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET ";
$sql.= ", description = '".addslashes($this->description)."'";
$sql.= ", duree = ".$this->duree;
- $sql.= ", fk_projet = ".$this->project_id;
+ $sql.= ", fk_projet = ".$this->fk_project;
$sql.= " WHERE rowid = ".$id;
$sql.= " AND entity = ".$conf->entity;
@@ -211,7 +208,7 @@ class Fichinter extends CommonObject
$this->datec = $this->db->jdate($obj->datec);
$this->datev = $this->db->jdate($obj->datev);
$this->datem = $this->db->jdate($obj->datem);
- $this->project_id = $obj->fk_projet;
+ $this->fk_project = $obj->fk_projet;
$this->note_public = $obj->note_public;
$this->note_private = $obj->note_private;
$this->modelpdf = $obj->model_pdf;
diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php
index a93cb811c39..8983aad1902 100644
--- a/htdocs/fourn/commande/dispatch.php
+++ b/htdocs/fourn/commande/dispatch.php
@@ -45,9 +45,9 @@ $id = isset($_GET["id"])?$_GET["id"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'commande_fournisseur', $id,'');
-// R�cup�ration de l'id de projet
-$projetid = 0;
-if ($_GET["projetid"]) $projetid = $_GET["projetid"];
+// Recuperation de l'id de projet
+$projectid = 0;
+if ($_GET["projectid"]) $projectid = $_GET["projectid"];
$mesg='';
diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php
index f8d68ddfabd..4a069927982 100644
--- a/htdocs/fourn/commande/fiche.php
+++ b/htdocs/fourn/commande/fiche.php
@@ -54,8 +54,8 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'commande_fournisseur', $id,'');
// Recuperation de l'id de projet
-$projetid = 0;
-if ($_GET["projetid"]) $projetid = $_GET["projetid"];
+$projectid = 0;
+if ($_GET["projectid"]) $projectid = $_GET["projectid"];
$mesg='';
@@ -69,7 +69,7 @@ if ($_POST['action'] == 'classin')
{
$commande = new CommandeFournisseur($db);
$commande->fetch($id);
- $commande->setProject($_POST["projetid"]);
+ $commande->setProject($_POST["projectid"]);
}
if ($_REQUEST['action'] == 'setremisepercent' && $user->rights->fournisseur->commande->creer)
@@ -692,11 +692,11 @@ if ($id > 0 || ! empty($ref))
print '';
if ($_GET['action'] == 'classer')
{
- $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->projet_id, 'projetid');
+ $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->fk_project, 'projectid');
}
else
{
- $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->projet_id, 'none');
+ $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->fk_project, 'none');
}
print ' | ';
print '';
diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index 40819b26494..e1e8746139c 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -396,7 +396,7 @@ if ($_POST['action'] == 'classin')
{
$facture = new FactureFournisseur($db,'',$_GET['facid']);
$facture->fetch($_GET['facid']);
- $facture->setProject($_POST['projetid']);
+ $facture->setProject($_POST['projectid']);
}
@@ -897,7 +897,7 @@ else
print '';
if ($_GET['action'] == 'classer')
{
- $html->form_project($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->socid,$fac->fk_project,'projetid');
+ $html->form_project($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->socid,$fac->fk_project,'projectid');
}
else
{
diff --git a/htdocs/fourn/fournisseur.commande.class.php b/htdocs/fourn/fournisseur.commande.class.php
index 37f85cf5536..60eb476c5be 100644
--- a/htdocs/fourn/fournisseur.commande.class.php
+++ b/htdocs/fourn/fournisseur.commande.class.php
@@ -114,7 +114,6 @@ class CommandeFournisseur extends Commande
$this->source = $obj->source;
$this->facturee = $obj->facture;
$this->fk_project = $obj->fk_project;
- $this->projet_id = $obj->fk_project; // For compatibility with old code
$this->note = $obj->note;
$this->note_public = $obj->note_public;
$this->modelpdf = $obj->model_pdf;
diff --git a/htdocs/html.formother.class.php b/htdocs/html.formother.class.php
index 5c6eb890cf3..341f6626ec4 100644
--- a/htdocs/html.formother.class.php
+++ b/htdocs/html.formother.class.php
@@ -359,10 +359,10 @@ function PLineSelect(&$inc, $parent, $lines, $level=0, $selected=0)
// Break on a new project
if ($parent == 0)
{
- if ($lines[$i]->projectid != $lastprojectid)
+ if ($lines[$i]->fk_project != $lastprojectid)
{
if ($i > 0 && $conf->browser->firefox) print '';
- print '\n";
- $lastprojectid=$lines[$i]->projectid;
+ $lastprojectid=$lines[$i]->fk_project;
$inc++;
}
}
@@ -383,7 +383,7 @@ function PLineSelect(&$inc, $parent, $lines, $level=0, $selected=0)
// Print task
if ($lines[$i]->id > 0)
{
- print ' |