diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index dd79af04bcb..5f71b230537 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -55,6 +55,7 @@ TasksOnOpenedProject=Tasks on open projects WorkloadNotDefined=Workload not defined NewTimeSpent=Time spent MyTimeSpent=My time spent +BillTime=Bill the time spent Tasks=Tasks Task=Task TaskDateStart=Task start date diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 71be9b5d4a3..7494a5a15bb 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -161,6 +161,7 @@ if (empty($reshook)) $object->statut = $status; $object->opp_status = $opp_status; $object->opp_percent = $opp_percent; + $object->bill_time = (GETPOST('bill_time','alpha')=='on'?1:0); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -261,6 +262,7 @@ if (empty($reshook)) if (isset($_POST['budget_amount'])) $object->budget_amount= price2num(GETPOST('budget_amount','alpha')); if (isset($_POST['opp_status'])) $object->opp_status = $opp_status; if (isset($_POST['opp_percent'])) $object->opp_percent = $opp_percent; + $object->bill_time = (GETPOST('bill_time','alpha')=='on'?1:0); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -599,6 +601,14 @@ if ($action == 'create' && $user->rights->projet->creer) print ''; print ''; + // Bill time + if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print ''.$langs->trans("BillTime").''; + print ''; + print ''; + } + if ($conf->categorie->enabled) { // Categories print ''.$langs->trans("Categories").''; @@ -826,6 +836,14 @@ elseif ($object->id > 0) print ''; print ''; + // Bill time + if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print ''.$langs->trans("BillTime").''; + print 'bill_time) ? ' checked="checked"' : '').'">'; + print ''; + } + // Tags-Categories if ($conf->categorie->enabled) { @@ -948,6 +966,14 @@ elseif ($object->id > 0) print nl2br($object->description); print ''; + // Bill time + if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print ''.$langs->trans("BillTime").''; + print ''.yn($object->bill_time).''; + print ''; + } + // Categories if($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 6e8c12793cc..ed25f3ba813 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -64,6 +64,7 @@ class Project extends CommonObject var $user_close_id; var $public; //!< Tell if this is a public or private project var $budget_amount; + var $bill_time; // Is the time spent on project must be invoiced or not var $statuts_short; var $statuts_long; @@ -178,6 +179,7 @@ class Project extends CommonObject $sql.= ", datee"; $sql.= ", opp_amount"; $sql.= ", budget_amount"; + $sql.= ", bill_time"; $sql.= ", entity"; $sql.= ") VALUES ("; $sql.= "'" . $this->db->escape($this->ref) . "'"; @@ -297,6 +299,7 @@ class Project extends CommonObject $sql.= ", opp_amount = " . (strcmp($this->opp_amount, '') ? price2num($this->opp_amount) : "null"); $sql.= ", budget_amount = " . (strcmp($this->budget_amount, '') ? price2num($this->budget_amount) : "null"); $sql.= ", fk_user_modif = " . $user->id; + $sql.= ", bill_time = " . ($this->bill_time ? 1 : 0); $sql.= " WHERE rowid = " . $this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); @@ -394,7 +397,8 @@ class Project extends CommonObject if (empty($id) && empty($ref)) return -1; $sql = "SELECT rowid, ref, title, description, public, datec, opp_amount, budget_amount,"; - $sql.= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut, fk_opp_status, opp_percent, note_private, note_public, model_pdf"; + $sql.= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut, fk_opp_status, opp_percent,"; + $sql.= " note_private, note_public, model_pdf, bill_time"; $sql.= " FROM " . MAIN_DB_PREFIX . "projet"; if (! empty($id)) { @@ -441,6 +445,7 @@ class Project extends CommonObject $this->opp_percent = $obj->opp_percent; $this->budget_amount = $obj->budget_amount; $this->modelpdf = $obj->model_pdf; + $this->bill_time = (int) $obj->bill_time; $this->db->free($resql);