From 3ca31e34cbd6e767d286628c6f7875158d070bf1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Feb 2015 10:58:05 +0100 Subject: [PATCH] New: Add field "budget" (amount) on projects. --- .../install/mysql/migration/3.7.0-3.8.0.sql | 2 +- htdocs/projet/card.php | 19 ++++++++++++++++++- htdocs/projet/class/project.class.php | 3 ++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 6024996624a..831185a9203 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -182,5 +182,5 @@ CREATE TABLE llx_expensereport_det ) ENGINE=innodb; -ALTER TABLE ll_projet ADD COLUMN budget_amount double(24,8); +ALTER TABLE llx_projet ADD COLUMN budget_amount double(24,8); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 5887bb6f1d8..1103396658f 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -141,6 +141,7 @@ if (empty($reshook)) $object->socid = GETPOST('socid','int'); $object->description = GETPOST('description'); // Do not use 'alpha' here, we want field as it is $object->public = GETPOST('public','alpha'); + $object->budget_amount = GETPOST('budget_amount','int'); $object->datec=dol_now(); $object->date_start=$date_start; $object->date_end=$date_end; @@ -217,6 +218,7 @@ if (empty($reshook)) $object->socid = GETPOST('socid','int'); $object->description = GETPOST('description'); // Do not use 'alpha' here, we want field as it is $object->public = GETPOST('public','alpha'); + $object->budget_amount= GETPOST('budget_amount','int'); $object->date_start = empty($_POST["projectstart"])?'':$date_start; $object->date_end = empty($_POST["projectend"])?'':$date_end; @@ -433,7 +435,7 @@ if ($action == 'create' && $user->rights->projet->creer) print ''.$langs->trans("Ref").''; // Label - print ''.$langs->trans("Label").''; + print ''.$langs->trans("Label").''; // Customer print ''.$langs->trans("ThirdParty").''; @@ -462,6 +464,11 @@ if ($action == 'create' && $user->rights->projet->creer) print $form->select_date(($date_end?$date_end:-1),'projectend'); print ''; + // Budget + print ''.$langs->trans("Budget").''; + print ''; + print ''; + // Description print ''.$langs->trans("Description").''; print ''; @@ -602,6 +609,11 @@ else print $form->select_date($object->date_end?$object->date_end:-1,'projectend'); print ''; + // Budget + print ''.$langs->trans("Budget").''; + print ''; + print ''; + // Description print ''.$langs->trans("Description").''; print ''; @@ -663,6 +675,11 @@ else print dol_print_date($object->date_end,'day'); print ''; + // Budget + print ''.$langs->trans("Budget").''; + if ($object->budget_amount != '') print price($object->budget_amount,'',$langs,0,0,0,$conf->currency); + print ''; + // Description print ''.$langs->trans("Description").''; print nl2br($object->description); diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index ce699df0b32..e1aa84f1f4c 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -126,6 +126,7 @@ class Project extends CommonObject $sql.= ", '".$this->db->idate($now)."'"; $sql.= ", " . ($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null'); $sql.= ", " . ($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); + $sql.= ", " . $this->budget_amount; $sql.= ", ".$conf->entity; $sql.= ")"; @@ -420,7 +421,7 @@ class Project extends CommonObject } if ($type == 'expensereport') { - $sql = "SELECT id as rowid FROM " . MAIN_DB_PREFIX . "expensereport as e, " . MAIN_DB_PREFIX . "expensereport_det as ed WHERE ed.fk_project=" . $this->id; + $sql = "SELECT e.rowid FROM " . MAIN_DB_PREFIX . "expensereport as e, " . MAIN_DB_PREFIX . "expensereport_det as ed WHERE e.rowid = ed.fk_expensereport AND ed.fk_projet=" . $this->id; } if ($dates > 0) {