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 6024996624afd468353e19f84084155a249ab0df..831185a9203a1bfc5b7154e690d26050c39983b1 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 5887bb6f1d8277adbefbc91e6aad0d2c01cb77e9..1103396658f17d0130326069d66c2df059a2ec03 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 '<tr><td><span class="fieldrequired">'.$langs->trans("Ref").'</span></td><td><input size="12" type="text" name="ref" value="'.($_POST["ref"]?$_POST["ref"]:$defaultref).'"></td></tr>'; // Label - print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td><td><input size="40" type="text" name="title" value="'.$_POST["title"].'"></td></tr>'; + print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td><td><input size="40" type="text" name="title" value="'.GETPOST("title").'"></td></tr>'; // Customer print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>'; @@ -462,6 +464,11 @@ if ($action == 'create' && $user->rights->projet->creer) print $form->select_date(($date_end?$date_end:-1),'projectend'); print '</td></tr>'; + // Budget + print '<tr><td>'.$langs->trans("Budget").'</td>'; + print '<td><input size="4" type="text" name="budget_amount" value="'.(isset($_POST['budget_amount'])?price(GETPOST('budget_amount')):'').'"></td></tr>'; + print '</td></tr>'; + // Description print '<tr><td valign="top">'.$langs->trans("Description").'</td>'; print '<td>'; @@ -602,6 +609,11 @@ else print $form->select_date($object->date_end?$object->date_end:-1,'projectend'); print '</td></tr>'; + // Budget + print '<tr><td>'.$langs->trans("Budget").'</td>'; + print '<td><input size="4" type="text" name="budget_amount" value="'.(price(isset($_POST['budget_amount'])?GETPOST('budget_amount'):$object->budget_amount)).'"></td></tr>'; + print '</td></tr>'; + // Description print '<tr><td valign="top">'.$langs->trans("Description").'</td>'; print '<td>'; @@ -663,6 +675,11 @@ else print dol_print_date($object->date_end,'day'); print '</td></tr>'; + // Budget + print '<tr><td>'.$langs->trans("Budget").'</td><td>'; + if ($object->budget_amount != '') print price($object->budget_amount,'',$langs,0,0,0,$conf->currency); + print '</td></tr>'; + // Description print '<td valign="top">'.$langs->trans("Description").'</td><td>'; print nl2br($object->description); diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index ce699df0b32e11a3695e4f90a2743ca7b9ce1fa0..e1aa84f1f4c6bef463c2b71e92ccee1aa57503a6 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) {