Fix: uniformise and clean code

This commit is contained in:
Regis Houssin 2010-03-11 14:31:16 +00:00
parent 2dc31fa613
commit 6822a1b18b
29 changed files with 167 additions and 168 deletions

View File

@ -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);

View File

@ -496,8 +496,8 @@ if ($_GET["action"] == 'create')
$langs->load("project");
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td>';
$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 ' &nbsp; <a href="../../projet/fiche.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>';
}

View File

@ -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 '</td><td colspan="3">';
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 '</td></tr>';
}
else
{
print '</td></tr></table>';
if (!empty($propal->projetidp))
if (!empty($propal->fk_project))
{
print '<td colspan="3">';
$proj = new Project($db);
$proj->fetch($propal->projetidp);
print '<a href="../projet/fiche.php?id='.$propal->projetidp.'" title="'.$langs->trans('ShowProject').'">';
$proj->fetch($propal->fk_project);
print '<a href="../projet/fiche.php?id='.$propal->fk_project.'" title="'.$langs->trans('ShowProject').'">';
print $proj->ref;
print '</a>';
print '</td>';

View File

@ -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;

View File

@ -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 '<input type="hidden" name="socid" value="'.$soc->id.'">' ."\n";
print '<input type="hidden" name="remise_percent" value="'.$soc->remise_client.'">';
print '<input name="facnumber" type="hidden" value="provisoire">';
if (isset($_GET["origin"]) && $_GET["origin"] != 'project' && isset($_GET["originid"]))
{
print '<input type="hidden" name="origin" value="'.$_GET["origin"].'">';
print '<input type="hidden" name="originid" value="'.$_GET["originid"].'">';
}
print '<table class="border" width="100%">';
@ -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 '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
$numprojet=select_projects($soc->id,$projetid,'projetid');
$numprojet=select_projects($soc->id,$projectid);
if ($numprojet==0)
{
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddProject").'</a>';
@ -1603,11 +1610,11 @@ else
print '</td><td colspan="2">';
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 '</td></tr>';
}

View File

@ -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

View File

@ -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 '</td><td colspan="2">';
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 '</td></tr>';
}

View File

@ -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 "<tr><td>".$langs->trans("Project")."</td><td>";
select_projects('',$_POST["projetid"],"projetid");
select_projects('',$_POST["projectid"],"projectid");
print "</td></tr>\n";
}
@ -327,7 +327,7 @@ if ($_GET["rowid"] && $_GET["action"] == 'edit')
{
$langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
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 '</td></tr>';
}

View File

@ -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 '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
select_projects($soc->id, $projetid, 'projetid');
select_projects($soc->id, $projectid, 'projectid');
print '</td></tr>';
}
@ -2828,11 +2828,11 @@ else
print '</td><td colspan="3">';
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 '</td>';
print '</tr>';

View File

@ -234,11 +234,11 @@ if ($_GET["facid"] > 0)
$langs->load("projects");
print '<tr>';
print '<td>'.$langs->trans("Project").'</td><td colspan="3">';
if ($fac->projetid > 0)
if ($fac->fk_project > 0)
{
$projet = New Project($db);
$projet->fetch($fac->projetid);
print '<a href="'.DOL_URL_ROOT.'/projet/fiche.php?id='.$fac->projetid.'">'.$projet->title.'</a>';
$project = New Project($db);
$project->fetch($fac->fk_project);
print '<a href="'.DOL_URL_ROOT.'/projet/fiche.php?id='.$fac->fk_project.'">'.$project->title.'</a>';
}
else
{

View File

@ -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;

View File

@ -144,11 +144,11 @@ if ($_GET["action"] == 'create')
if ($conf->projet->enabled)
{
print "<tr><td>".$langs->trans("Project")."</td><td>";
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 "</td></tr>";
}

View File

@ -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 '</td><td colspan="3">';
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 '</td></tr>';
}
else
{
print '</td></tr></table>';
if (!empty($propal->projetidp))
if (!empty($propal->fk_project))
{
print '<td colspan="3">';
$proj = new Project($db);
$proj->fetch($propal->projetidp);
print '<a href="../projet/fiche.php?id='.$propal->projetidp.'" title="'.$langs->trans('ShowProject').'">';
print $proj->ref;
$project = new Project($db);
$project->fetch($propal->fk_project);
print '<a href="../projet/fiche.php?id='.$propal->fk_project.'" title="'.$langs->trans('ShowProject').'">';
print $project->ref;
print '</a>';
print '</td>';
}
else {
else
{
print '<td colspan="3">&nbsp;</td>';
}
}

View File

@ -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 '<tr><td>'.$langs->trans("Project").'</td><td>';
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 "</td></tr>";
}
@ -750,11 +750,11 @@ else
print '</td><td colspan="3">';
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 "</td></tr>";
}

View File

@ -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;

View File

@ -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 '</td><td colspan="2">';
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 '</td></tr>';
}

View File

@ -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').",";

View File

@ -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 '</td><td colspan="3">';
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 '</td>';
print '</tr>';

View File

@ -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;

View File

@ -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<EFBFBD>cup<EFBFBD>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='';

View File

@ -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 '</td><td colspan="2">';
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 '</td>';
print '</tr>';

View File

@ -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 '</td><td colspan="3">';
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
{

View File

@ -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;

View File

@ -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 '<option value="0" disabled="true">----------</option>';
print '<option value="'.$lines[$i]->projectid.'_0">'; // Project -> Task
print '<option value="'.$lines[$i]->fk_project.'_0">'; // Project -> Task
print $langs->trans("Project").' '.$lines[$i]->projectref;
if (empty($lines[$i]->public))
{
@ -372,10 +372,10 @@ function PLineSelect(&$inc, $parent, $lines, $level=0, $selected=0)
{
print ' ('.$langs->trans("Visibility").': '.$langs->trans("SharedProject").')';
}
//print '-'.$parent.'-'.$lines[$i]->projectid.'-'.$lastprojectid;
//print '-'.$parent.'-'.$lines[$i]->fk_project.'-'.$lastprojectid;
print "</option>\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 '<option value="'.$lines[$i]->projectid.'_'.$lines[$i]->id.'"';
print '<option value="'.$lines[$i]->fk_project.'_'.$lines[$i]->id.'"';
if ($lines[$i]->id == $selected) print ' selected="true"';
print '>';
print $langs->trans("Project").' '.$lines[$i]->projectref;

View File

@ -248,20 +248,20 @@ function PLinesb(&$inc, $parent, $lines, &$level, &$projectsrole)
if ($lines[$i]->fk_parent == $parent)
{
// Break on a new project
if ($parent == 0 && $lines[$i]->projectid != $lastprojectid)
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
{
$var = !$var;
$lastprojectid=$lines[$i]->projectid;
$lastprojectid=$lines[$i]->fk_project;
}
print "<tr $bc[$var]>\n";
// Project
print "<td>";
$projectstatic->id=$lines[$i]->projectid;
$projectstatic->id=$lines[$i]->fk_project;
$projectstatic->ref=$lines[$i]->projectref;
$projectstatic->public=$lines[$i]->public;
$projectstatic->label=$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->projectid];
$projectstatic->label=$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project];
print $projectstatic->getNomUrl(1);
print "</td>";
@ -289,11 +289,11 @@ function PLinesb(&$inc, $parent, $lines, &$level, &$projectsrole)
print "</td>\n";
$disabled=1;
//print "x".$lines[$i]->projectid;
//print "x".$lines[$i]->fk_project;
//var_dump($lines[$i]);
//var_dump($projectsrole[$lines[$i]->projectid]);
//var_dump($projectsrole[$lines[$i]->fk_project]);
// If at least one role for project
if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->projectid]) || $user->rights->projet->all->creer) $disabled=0;
if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) $disabled=0;
print '<td nowrap="nowrap">';
print $form->select_date('',$lines[$i]->id,'','','',"addtime");
@ -345,7 +345,7 @@ function PLines(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole
if ($parent == 0) $level = 0;
// Process line
// print "i:".$i."-".$lines[$i]->projectid.'<br>';
// print "i:".$i."-".$lines[$i]->fk_project.'<br>';
if ($lines[$i]->fk_parent == $parent)
{
@ -377,10 +377,10 @@ function PLines(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole
if ($showline)
{
// Break on a new project
if ($parent == 0 && $lines[$i]->projectid != $lastprojectid)
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
{
$var = !$var;
$lastprojectid=$lines[$i]->projectid;
$lastprojectid=$lines[$i]->fk_project;
}
print "<tr ".$bc[$var].">\n";
@ -391,7 +391,7 @@ function PLines(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole
print "<td>";
//var_dump($taskrole);
if ($showlineingray) print '<i>';
$projectstatic->id=$lines[$i]->projectid;
$projectstatic->id=$lines[$i]->fk_project;
$projectstatic->ref=$lines[$i]->projectref;
$projectstatic->public=$lines[$i]->public;
print $projectstatic->getNomUrl(1);
@ -597,7 +597,7 @@ function print_projecttasks_array($db,$mine,$socid,$projectsListId)
{
$objp = $db->fetch_object($resql);
$projectstatic->id = $objp->projectid;
$projectstatic->id = $objp->fk_project;
$projectstatic->user_author_id = $objp->fk_user_creat;
$projectstatic->public = $objp->public;

View File

@ -509,7 +509,7 @@ class Livraison extends CommonObject
$this->origin = $expedition->origin;
$this->origin_id = $expedition->origin_id;
$this->note = $expedition->note;
$this->projetid = $expedition->projetidp;
$this->fk_project = $expedition->fk_project;
$this->date_livraison = $expedition->date_livraison;
$this->adresse_livraison_id = $expedition->adresse_livraison_id; // TODO obsolete
$this->fk_delivery_address = $expedition->adresse_livraison_id;

View File

@ -41,7 +41,7 @@ class Notify
var $date;
var $duree;
var $note;
var $projet_id;
var $fk_project;
// Les codes actions sont definis dans la table llx_notify_def
// \todo utiliser des codes texte plutot que numerique

View File

@ -496,7 +496,7 @@ class Task extends CommonObject
if (! $error)
{
$tasks[$i]->id = $obj->taskid;
$tasks[$i]->projectid = $obj->projectid;
$tasks[$i]->fk_project = $obj->projectid;
$tasks[$i]->projectref = $obj->ref;
$tasks[$i]->projectlabel = $obj->plabel;
$tasks[$i]->label = $obj->label;

View File

@ -56,8 +56,7 @@ class Propal extends CommonObject
var $client; // Objet societe client (a charger par fetch_client)
var $contactid;
var $projetidp; // deprecated (for compatibility)
var $projectid;
var $fk_project;
var $author;
var $ref;
var $ref_client;
@ -635,10 +634,10 @@ class Propal extends CommonObject
}
// Affectation au projet
if ($resql && $this->projectid)
if ($resql && $this->fk_project)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
$sql.= " SET fk_projet=".$this->projectid;
$sql.= " SET fk_projet=".$this->fk_project;
$sql.= " WHERE ref='".$this->ref."'";
$sql.= " AND entity = ".$conf->entity;
@ -838,8 +837,7 @@ class Propal extends CommonObject
$this->total_tva = $obj->tva;
$this->total_ttc = $obj->total;
$this->socid = $obj->fk_soc;
$this->projectid = $obj->fk_projet;
$this->projetidp = $obj->fk_projet; // TODO obsolete
$this->fk_project = $obj->fk_projet;
$this->modelpdf = $obj->model_pdf;
$this->note = $obj->note;
$this->note_public = $obj->note_public;