Prepare reengeneering of project usage

This commit is contained in:
Laurent Destailleur 2019-09-01 01:40:51 +02:00
parent 7f5728ead9
commit 04057cd83e
22 changed files with 494 additions and 95 deletions

View File

@ -448,7 +448,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
$projectstatic->ref=$lines[$i]->projectref;
$projectstatic->public=$lines[$i]->public;
$projectstatic->title=$lines[$i]->projectlabel;
$projectstatic->bill_time=$lines[$i]->bill_time;
$projectstatic->usage_bill_time=$lines[$i]->usage_bill_time;
$taskstatic->id=$lines[$i]->id;
$taskstatic->ref=$lines[$i]->ref;
@ -572,7 +572,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
{
// Time not billed
print '<td class="right">';
if ($lines[$i]->bill_time)
if ($lines[$i]->usage_bill_time)
{
print convertSecondToTime($lines[$i]->tobill, 'allhourmin');
$total_projectlinesa_tobill += $lines[$i]->tobill;
@ -585,7 +585,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Time billed
print '<td class="right">';
if ($lines[$i]->bill_time)
if ($lines[$i]->usage_bill_time)
{
print convertSecondToTime($lines[$i]->billed, 'allhourmin');
$total_projectlinesa_billed += $lines[$i]->billed;
@ -1047,7 +1047,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER["PHP_SELF"], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.bill_time']['checked'])) print_liste_field_titre($arrayfields['p.bill_time']['label'], $_SERVER["PHP_SELF"], 'p.bill_time', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.usage_bill_time']['checked'])) print_liste_field_titre($arrayfields['p.usage_bill_time']['label'], $_SERVER["PHP_SELF"], 'p.usage_bill_time', "", $param, '', $sortfield, $sortorder, 'right ');
$extrafieldsobjectkey='projet';
$extrafieldsobjectprefix='efp.';
@ -1082,10 +1082,10 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
print price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
print "</td>\n";
}
if (! empty($arrayfields['p.bill_time']['checked']))
if (! empty($arrayfields['p.usage_bill_time']['checked']))
{
print '<td class="nowrap">';
print yn($lines[$i]->bill_time);
print yn($lines[$i]->usage_bill_time);
print "</td>\n";
}
@ -1427,7 +1427,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER["PHP_SELF"], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.bill_time']['checked'])) print_liste_field_titre($arrayfields['p.bill_time']['label'], $_SERVER["PHP_SELF"], 'p.bill_time', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.usage_bill_time']['checked'])) print_liste_field_titre($arrayfields['p.usage_bill_time']['label'], $_SERVER["PHP_SELF"], 'p.usage_bill_time', "", $param, '', $sortfield, $sortorder, 'right ');
$extrafieldsobjectkey='projet';
$extrafieldsobjectprefix='efp.';
@ -1462,10 +1462,10 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
print price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
print "</td>\n";
}
if (! empty($arrayfields['p.bill_time']['checked']))
if (! empty($arrayfields['p.usage_bill_time']['checked']))
{
print '<td class="nowrap">';
print yn($lines[$i]->bill_time);
print yn($lines[$i]->usage_bill_time);
print "</td>\n";
}

View File

@ -325,7 +325,7 @@ if (($action=="create") || ($action=="edit"))
if ($action=="edit") dol_fiche_head($head, 'card', $langs->trans("CronTask"), 0, 'cron');
else dol_fiche_head('');
print '<table class="border" width="100%">';
print '<table class="border centpercent">';
print '<tr><td class="fieldrequired titlefieldcreate">';
print $langs->trans('CronLabel')."</td>";
@ -567,7 +567,7 @@ else
// box add_jobs_box
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border centpercent tableforfield">';
print '<tr><td class="titlefield">';
print $langs->trans('CronLabel')."</td>";
@ -638,7 +638,7 @@ else
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border centpercent tableforfield">';
print '<tr><td class="titlefield">';
print $langs->trans('CronEvery')."</td>";
@ -697,7 +697,7 @@ else
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border centpercent tableforfield">';
print '<tr><td class="titlefield">';
print $langs->trans('CronDtLastLaunch')."</td><td>";

View File

@ -81,3 +81,13 @@ ALTER TABLE llx_oauth_token ADD COLUMN fk_soc integer DEFAULT NULL after token;
ALTER TABLE llx_mailing ADD COLUMN tms timestamp;
ALTER TABLE llx_mailing_cibles ADD COLUMN tms timestamp;
ALTER TABLE llx_projet ADD COLUMN usage_opportunity integer DEFAULT 0;
ALTER TABLE llx_projet ADD COLUMN usage_task integer DEFAULT 1;
ALTER TABLE llx_projet CHANGE COLUMN bill_time usage_bill_time integer DEFAULT 0; -- rename existing field
ALTER TABLE llx_projet ADD COLUMN usage_organize_event integer DEFAULT 0;
UPDATE llx_projet set usage_opportunity = 1 WHERE fk_opp_status > 0;

View File

@ -42,7 +42,10 @@ create table llx_projet
--budget_days real, -- budget in days is sum of field planned_workload of tasks
opp_amount double(24,8),
budget_amount double(24,8),
bill_time integer DEFAULT 0, -- Set to 1 if time spent must be converted into invoices
usage_opportunity integer DEFAULT 0, -- Set to 1 if project is used to follow an opportunity
usage_task integer DEFAULT 1, -- Set to 1 if project is used to manage tasks and/or record timesheet
usage_bill_time integer DEFAULT 0, -- Set to 1 if time spent must be converted into invoices
usage_organize_event integer DEFAULT 0, -- Set to 1 if you want to use project to organize an event, receive attendees subscription
model_pdf varchar(255),
import_key varchar(14) -- Import key
)ENGINE=innodb;

View File

@ -203,6 +203,8 @@ AssignTask=Assigner
ProjectOverview=Vue d'ensemble
ManageTasks=Utiliser les projets pour suivre les tâches et/ou saisir du temps consommé (feuilles de temps)
ManageOpportunitiesStatus=Utiliser les projets pour suivre les affaires / opportunités
ProjectFollowOpportunity=Follow a lead or opportunity
ProjectFollowTasks=Follow tasks and time spent
ProjectNbProjectByMonth=Nb de projets créés par mois
ProjectNbTaskByMonth=Nb de tâches créées par mois
ProjectOppAmountOfProjectsByMonth=Montant des opportunités par mois

View File

@ -125,7 +125,7 @@ $arrayfields['t.progress']=array('label'=>'ProgressDeclared', 'checked'=>1, 'ena
'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>104),
'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>105),
'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110),
'p.bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115),
'p.usage_bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115),
);
*/
// Extra fields

View File

@ -133,7 +133,7 @@ $arrayfields=array();
'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>104),
'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>105),
'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110),
'p.bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115),
'p.usage_bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115),
);*/
$arrayfields['t.planned_workload']=array('label'=>'PlannedWorkload', 'checked'=>1, 'enabled'=>1, 'position'=>0);
$arrayfields['t.progress']=array('label'=>'ProgressDeclared', 'checked'=>1, 'enabled'=>1, 'position'=>0);

View File

@ -156,13 +156,16 @@ if (empty($reshook))
$object->public = GETPOST('public', 'alpha');
$object->opp_amount = price2num(GETPOST('opp_amount', 'alpha'));
$object->budget_amount = price2num(GETPOST('budget_amount', 'alpha'));
$object->datec = dol_now();
$object->date_c = dol_now();
$object->date_start = $date_start;
$object->date_end = $date_end;
$object->statut = $status;
$object->opp_status = $opp_status;
$object->opp_percent = $opp_percent;
$object->bill_time = (GETPOST('bill_time', 'alpha')=='on'?1:0);
$object->usage_opportunity = (GETPOST('usage_opportunity', 'alpha')=='on'?1:0);
$object->usage_task = (GETPOST('usage_task', 'alpha')=='on'?1:0);
$object->usage_bill_time = (GETPOST('usage_bill_time', 'alpha')=='on'?1:0);
$object->usage_organize_event = (GETPOST('usage_organize_event', 'alpha')=='on'?1:0);
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
@ -263,7 +266,10 @@ 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);
$object->usage_opportunity = (GETPOST('usage_opportunity', 'alpha')=='on'?1:0);
$object->usage_task = (GETPOST('usage_task', 'alpha')=='on'?1:0);
$object->usage_bill_time = (GETPOST('usage_bill_time', 'alpha')=='on'?1:0);
$object->usage_organize_event = (GETPOST('usage_organize_event', 'alpha')=='on'?1:0);
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
@ -539,6 +545,39 @@ if ($action == 'create' && $user->rights->projet->creer)
// Label
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td><td><input size="80" type="text" name="title" value="'.dol_escape_htmltag(GETPOST("title", 'none')).'" autofocus></td></tr>';
// Usage (opp, task, bill time, ...)
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print '<input type="checkbox" name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha')!=''?' checked="checked"':'') : ' checked="checked"').'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<input type="checkbox" name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha')!=''?' checked="checked"':'') : ' checked="checked"').'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" name="usage_bill_time"'.(GETPOST('usage_bill_time', 'alpha')!=''?' checked="checked"':'').'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
/*
print '<input type="checkbox" name="usage_organize_event"'.(GETPOST('usage_organize_event', 'alpha')!=''?' checked="checked"':'').'"> ';
$htmltext = $langs->trans("OrganizeEvent");
print $form->textwithpicto($langs->trans("OrganizeEvent"), $htmltext);*/
print '</td>';
print '</tr>';
// Thirdparty
if ($conf->societe->enabled)
{
@ -619,17 +658,6 @@ if ($action == 'create' && $user->rights->projet->creer)
print '<textarea name="description" wrap="soft" class="centpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST("description", 'none'), 0, 1).'</textarea>';
print '</td></tr>';
// Bill time
if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<tr><td>';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '</td>';
print '<td><input type="checkbox" name="bill_time"'.(GETPOST('bill_time', 'alpha')!=''?' checked="checked"':'').'"></td>';
print '</tr>';
}
if ($conf->categorie->enabled) {
// Categories
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
@ -769,6 +797,7 @@ elseif ($object->id > 0)
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
print '<td><input class="quatrevingtpercent" name="title" value="'.dol_escape_htmltag($object->title).'"></td></tr>';
// Status
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td><td>';
print '<select class="flat" name="status">';
@ -779,6 +808,34 @@ elseif ($object->id > 0)
print '</select>';
print '</td></tr>';
// Usage
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print '<input type="checkbox" name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha')!=''?' checked="checked"':'') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<input type="checkbox" name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha')!=''?' checked="checked"':'') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha')!=''?' checked="checked"':'') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
print '</td></tr>';
// Thirdparty
if ($conf->societe->enabled)
{
@ -857,17 +914,6 @@ elseif ($object->id > 0)
print '<textarea name="description" wrap="soft" class="centpercent" rows="'.ROWS_3.'">'.$object->description.'</textarea>';
print '</td></tr>';
// Bill time
if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<tr><td>';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '</td>';
print '<td><input type="checkbox" name="bill_time"'.((GETPOSTISSET('bill_time')?GETPOST('bill_time', 'alpha'):$object->bill_time) ? ' checked="checked"' : '').'"></td>';
print '</tr>';
}
// Tags-Categories
if ($conf->categorie->enabled)
{
@ -928,13 +974,41 @@ elseif ($object->id > 0)
print '<table class="border tableforfield" width="100%">';
// Usage
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha')!=''?' checked="checked"':'') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha')!=''?' checked="checked"':'') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha')!=''?' checked="checked"':'') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
print '</td></tr>';
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($object->public) print $langs->trans('SharedProject');
else print $langs->trans('PrivateProject');
print '</td></tr>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES) && ! empty($object->usage_opportunity))
{
// Opportunity status
print '<tr><td>'.$langs->trans("OpportunityStatus").'</td><td>';
@ -990,17 +1064,6 @@ elseif ($object->id > 0)
print nl2br($object->description);
print '</td></tr>';
// Bill time
if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<tr><td>';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '</td>';
print '<td>'.yn($object->bill_time).'</td>';
print '</tr>';
}
// Categories
if($conf->categorie->enabled) {
print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
@ -1118,7 +1181,7 @@ elseif ($object->id > 0)
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&amp;action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail').'</a></div>';
}
// Modify
// Modify
if ($object->statut != 2 && $user->rights->projet->creer)
{
if ($userWrite > 0)

View File

@ -88,7 +88,7 @@ class Project extends CommonObject
public $user_close_id;
public $public; //!< Tell if this is a public or private project
public $budget_amount;
public $bill_time; // Is the time spent on project must be invoiced or not
public $usage_bill_time; // Is the time spent on project must be invoiced or not
public $statuts_short;
public $statuts_long;
@ -213,7 +213,10 @@ class Project extends CommonObject
$sql.= ", datee";
$sql.= ", opp_amount";
$sql.= ", budget_amount";
$sql.= ", bill_time";
$sql.= ", usage_opportunity";
$sql.= ", usage_task";
$sql.= ", usage_bill_time";
$sql.= ", usage_organize_event";
$sql.= ", note_private";
$sql.= ", note_public";
$sql.= ", entity";
@ -232,7 +235,10 @@ class Project extends CommonObject
$sql.= ", " . ($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null');
$sql.= ", " . (strcmp($this->opp_amount, '') ? price2num($this->opp_amount) : 'null');
$sql.= ", " . (strcmp($this->budget_amount, '') ? price2num($this->budget_amount) : 'null');
$sql.= ", " . ($this->bill_time ? 1 : 0);
$sql.= ", " . ($this->usage_opportunity ? 1 : 0);
$sql.= ", " . ($this->usage_task ? 1 : 0);
$sql.= ", " . ($this->usage_bill_time ? 1 : 0);
$sql.= ", " . ($this->usage_organize_event ? 1 : 0);
$sql.= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : 'null');
$sql.= ", ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : 'null');
$sql.= ", ".$conf->entity;
@ -338,7 +344,10 @@ 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.= ", usage_opportunity = " . ($this->usage_opportunity ? 1 : 0);
$sql.= ", usage_task = " . ($this->usage_task ? 1 : 0);
$sql.= ", usage_bill_time = " . ($this->usage_bill_time ? 1 : 0);
$sql.= ", usage_organize_event = " . ($this->usage_organize_event ? 1 : 0);
$sql.= " WHERE rowid = " . $this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG);
@ -437,7 +446,7 @@ class Project extends CommonObject
$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,";
$sql.= " note_private, note_public, model_pdf, bill_time, entity";
$sql.= " note_private, note_public, model_pdf, usage_opportunity, usage_task, usage_bill_time, usage_organize_event, entity";
$sql.= " FROM " . MAIN_DB_PREFIX . "projet";
if (! empty($id))
{
@ -483,7 +492,10 @@ 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->usage_opportunity = (int) $obj->usage_opportunity;
$this->usage_task = (int) $obj->usage_task;
$this->usage_bill_time = (int) $obj->usage_bill_time;
$this->usage_organize_event = (int) $obj->usage_organize_event;
$this->entity = $obj->entity;
$this->db->free($resql);
@ -1097,6 +1109,11 @@ class Project extends CommonObject
$this->opp_amount = 20000;
$this->budget_amount = 10000;
$this->usage_opportunity = 1;
$this->usage_task = 1;
$this->usage_bill_time = 1;
$this->usage_organize_event = 1;
/*
$nbp = mt_rand(1, 9);
$xnbp = 0;
@ -1845,9 +1862,9 @@ class Project extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge indicateurs this->nb pour le tableau de bord
* Charge indicateurs this->nb pour le tableau de bord
*
* @return int <0 if KO, >0 if OK
* @return int <0 if KO, >0 if OK
*/
public function load_state_board()
{

View File

@ -748,7 +748,7 @@ class Task extends CommonObject
// List of tasks (does not care about permissions. Filtering will be done later)
$sql = "SELECT ";
if ($filteronprojuser > 0 || $filterontaskuser > 0) $sql.= " DISTINCT"; // We may get several time the same record if user has several roles on same project/task
$sql.= " p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus, p.bill_time,";
$sql.= " p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus, p.usage_bill_time,";
$sql.= " t.rowid as taskid, t.ref as taskref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut as status,";
$sql.= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang,";
$sql.= " s.rowid as thirdparty_id, s.nom as thirdparty_name, s.email as thirdparty_email,";
@ -847,7 +847,7 @@ class Task extends CommonObject
if ($morewherefilter) $sql.=$morewherefilter;
if ($includebilltime)
{
$sql.=" GROUP BY p.rowid, p.ref, p.title, p.public, p.fk_statut, p.bill_time,";
$sql.=" GROUP BY p.rowid, p.ref, p.title, p.public, p.fk_statut, p.usage_bill_time,";
$sql.=" t.datec, t.dateo, t.datee, t.tms,";
$sql.=" t.rowid, t.ref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut,";
$sql.=" t.dateo, t.datee, t.planned_workload, t.rang,";
@ -903,7 +903,7 @@ class Task extends CommonObject
$tasks[$i]->projectref = $obj->ref;
$tasks[$i]->projectlabel = $obj->plabel;
$tasks[$i]->projectstatus = $obj->projectstatus;
$tasks[$i]->bill_time = $obj->bill_time;
$tasks[$i]->usage_bill_time = $obj->usage_bill_time;
$tasks[$i]->label = $obj->label;
$tasks[$i]->description = $obj->description;
$tasks[$i]->fk_parent = $obj->fk_task_parent; // deprecated
@ -931,7 +931,7 @@ class Task extends CommonObject
$tasks[$i]->opp_amount = $obj->opp_amount;
$tasks[$i]->opp_percent = $obj->opp_percent;
$tasks[$i]->budget_amount = $obj->budget_amount;
$tasks[$i]->bill_time = $obj->bill_time;
$tasks[$i]->usage_bill_time = $obj->usage_bill_time;
if (!empty($extrafields->attributes['projet']['label']))
{

View File

@ -180,7 +180,35 @@ if ($id > 0 || ! empty($ref))
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
print '<table class="border tableforfield centpercent">';
// Usage
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha')!=''?' checked="checked"':'') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha')!=''?' checked="checked"':'') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha')!=''?' checked="checked"':'') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
print '</td></tr>';
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
@ -188,7 +216,7 @@ if ($id > 0 || ! empty($ref))
else print $langs->trans('PrivateProject');
print '</td></tr>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $object->oopp_status)
{
// Opportunity status
print '<tr><td>'.$langs->trans("OpportunityStatus").'</td><td>';
@ -244,7 +272,7 @@ if ($id > 0 || ! empty($ref))
if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<tr><td>'.$langs->trans("BillTime").'</td><td>';
print yn($object->bill_time);
print yn($object->usage_bill_time);
print '</td></tr>';
}

View File

@ -157,7 +157,35 @@ print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
print '<table class="border tableforfield centpercent">';
// Usage
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha')!=''?' checked="checked"':'') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha')!=''?' checked="checked"':'') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha')!=''?' checked="checked"':'') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
print '</td></tr>';
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
@ -221,7 +249,7 @@ print '</td></tr>';
if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<tr><td>'.$langs->trans("BillTime").'</td><td>';
print yn($object->bill_time);
print yn($object->usage_bill_time);
print '</td></tr>';
}

View File

@ -134,6 +134,34 @@ if (($id > 0 && is_numeric($id)) || ! empty($ref))
print '<table class="border tableforfield centpercent">';
// Usage
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha')!=''?' checked="checked"':'') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha')!=''?' checked="checked"':'') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha')!=''?' checked="checked"':'') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
print '</td></tr>';
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($object->public) print $langs->trans('SharedProject');

View File

@ -129,7 +129,7 @@ $arrayfields=array(
'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>104),
'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES?1:0), 'position'=>105),
'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110),
'p.bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115),
'p.usage_bill_time'=>array('label'=>$langs->trans("BillTimeShort"), 'checked'=>0, 'position'=>115),
'p.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500),
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'p.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
@ -279,7 +279,7 @@ if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0';
$distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once.
$sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut, p.fk_opp_status, p.public, p.fk_user_creat";
$sql.= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount, p.bill_time";
$sql.= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount, p.usage_bill_time";
$sql.= ", s.rowid as socid, s.nom as name, s.email";
$sql.= ", cls.code as opp_status_code";
// We'll need these fields in order to filter by categ
@ -619,7 +619,7 @@ if (! empty($arrayfields['p.budget_amount']['checked']))
print '<input type="text" class="flat" name="search_budget_amount" size="4" value="'.$search_budget_amount.'">';
print '</td>';
}
if (! empty($arrayfields['p.bill_time']['checked']))
if (! empty($arrayfields['p.usage_bill_time']['checked']))
{
print '<td class="liste_titre nowrap right">';
print '';
@ -674,7 +674,7 @@ if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre
if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER["PHP_SELF"], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.bill_time']['checked'])) print_liste_field_titre($arrayfields['p.bill_time']['label'], $_SERVER["PHP_SELF"], 'p.bill_time', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.usage_bill_time']['checked'])) print_liste_field_titre($arrayfields['p.usage_bill_time']['label'], $_SERVER["PHP_SELF"], 'p.usage_bill_time', "", $param, '', $sortfield, $sortorder, 'right ');
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
@ -856,12 +856,12 @@ while ($i < min($num, $limit))
if (! $i) $totalarray['totalbudgetfield']=$totalarray['nbfield'];
}
// Bill time
if (! empty($arrayfields['p.bill_time']['checked']))
if (! empty($arrayfields['p.usage_bill_time']['checked']))
{
print '<td class="right">';
if ($obj->bill_time)
if ($obj->usage_bill_time)
{
print yn($obj->bill_time);
print yn($obj->usage_bill_time);
}
print '</td>';
if (! $i) $totalarray['nbfield']++;

View File

@ -412,6 +412,34 @@ if ($id > 0 || ! empty($ref))
print '<table class="border tableforfield" width="100%">';
// Usage
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha')!=''?' checked="checked"':'') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha')!=''?' checked="checked"':'') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha')!=''?' checked="checked"':'') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
print '</td></tr>';
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($object->public) print $langs->trans('SharedProject');
@ -474,7 +502,7 @@ if ($id > 0 || ! empty($ref))
if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<tr><td>'.$langs->trans("BillTime").'</td><td>';
print yn($object->bill_time);
print yn($object->usage_bill_time);
print '</td></tr>';
}
@ -751,7 +779,7 @@ elseif ($id > 0 || ! empty($ref))
// progress resume not searchable
print '<td class="liste_titre right"></td>';
if ($object->bill_time)
if ($object->usage_bill_time)
{
print '<td class="liste_titre right">';
print '</td>';
@ -780,7 +808,7 @@ elseif ($id > 0 || ! empty($ref))
print_liste_field_titre("ProgressCalculated", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("ProgressDeclared", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("TaskProgressSummary", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center ');
if ($object->bill_time)
if ($object->usage_bill_time)
{
print_liste_field_titre("TimeToBill", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("TimeBilled", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right ');
@ -793,12 +821,12 @@ elseif ($id > 0 || ! empty($ref))
{
// Show all lines in taskarray (recursive function to go down on tree)
$j=0; $level=0;
$nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->bill_time?1:0));
$nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->usage_bill_time?1:0));
}
else
{
$colspan=10;
if ($object->bill_time) $colspan+=2;
if ($object->usage_bill_time) $colspan+=2;
print '<tr class="oddeven nobottom"><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoTasks").'</span></td></tr>';
}

View File

@ -150,12 +150,64 @@ if ($id > 0 || ! empty($ref))
print '<table class="border" width="100%">';
// Usage
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha')!=''?' checked="checked"':'') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha')!=''?' checked="checked"':'') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha')!=''?' checked="checked"':'') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
print '</td></tr>';
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($projectstatic->public) print $langs->trans('SharedProject');
else print $langs->trans('PrivateProject');
print '</td></tr>';
// Usage
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES) && ! empty($object->usage_opportunity))
{
// Opportunity status
print '<tr><td>'.$langs->trans("OpportunityStatus").'</td><td>';
$code = dol_getIdFromCode($db, $projectstatic->opp_status, 'c_lead_status', 'rowid', 'code');
if ($code) print $langs->trans("OppStatus".$code);
print '</td></tr>';
// Opportunity percent
print '<tr><td>'.$langs->trans("OpportunityProbability").'</td><td>';
if (strcmp($object->opp_percent, '')) print price($projectstatic->opp_percent, 0, $langs, 1, 0).' %';
print '</td></tr>';
// Opportunity Amount
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td><td>';
/*if ($object->opp_status)
{
print price($obj->opp_amount, 1, $langs, 1, 0, -1, $conf->currency);
}*/
if (strcmp($projectstatic->opp_amount, '')) print price($projectstatic->opp_amount, 0, $langs, 1, 0, -1, $conf->currency);
print '</td></tr>';
}
// Date start - end
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
$start = dol_print_date($projectstatic->date_start, 'day');

View File

@ -220,7 +220,35 @@ if ($id > 0 || ! empty($ref))
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
print '<table class="border tableforfield centpercent">';
// Usage
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha')!=''?' checked="checked"':'') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha')!=''?' checked="checked"':'') : ($projectstatic->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha')!=''?' checked="checked"':'') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
print '</td></tr>';
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';

View File

@ -165,6 +165,34 @@ if ($object->id > 0)
print '<table class="border tableforfield centpercent">';
// Usage
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha')!=''?' checked="checked"':'') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha')!=''?' checked="checked"':'') : ($projectstatic->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha')!=''?' checked="checked"':'') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
print '</td></tr>';
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($projectstatic->public) print $langs->trans('SharedProject');

View File

@ -255,7 +255,7 @@ else dol_print_error($db);
if (count($listoftaskcontacttype) == 0) $listoftaskcontacttype[0]='0'; // To avoid sql syntax error if not found
$distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is assigned only once.
$sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title as projecttitle, p.fk_statut as projectstatus, p.datee as projectdatee, p.fk_opp_status, p.public, p.fk_user_creat as projectusercreate, p.bill_time,";
$sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title as projecttitle, p.fk_statut as projectstatus, p.datee as projectdatee, p.fk_opp_status, p.public, p.fk_user_creat as projectusercreate, p.usage_bill_time,";
$sql.= " s.nom as name, s.rowid as socid,";
$sql.= " t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update,";
$sql.= " t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut";
@ -792,7 +792,7 @@ while ($i < min($num, $limit))
if (! empty($arrayfields['t.tobill']['checked']))
{
print '<td class="center">';
if ($obj->bill_time)
if ($obj->usage_bill_time)
{
print convertSecondToTime($obj->tobill, 'allhourmin');
$totalarray['totaltobill'] += $obj->tobill;
@ -809,7 +809,7 @@ while ($i < min($num, $limit))
if (! empty($arrayfields['t.billed']['checked']))
{
print '<td class="center">';
if ($obj->bill_time)
if ($obj->usage_bill_time)
{
print convertSecondToTime($obj->billed, 'allhourmin');
$totalarray['totalbilled'] += $obj->billed;

View File

@ -143,7 +143,35 @@ if ($object->id > 0)
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
// Usage
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha')!=''?' checked="checked"':'') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha')!=''?' checked="checked"':'') : ($projectstatic->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha')!=''?' checked="checked"':'') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
print '</td></tr>';
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
@ -177,7 +205,7 @@ if ($object->id > 0)
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border entpercent tableforfield">';
// Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';

View File

@ -258,7 +258,35 @@ if ($id > 0 || ! empty($ref))
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
// Usage
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha')!=''?' checked="checked"':'') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha')!=''?' checked="checked"':'') : ($projectstatic->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha')!=''?' checked="checked"':'') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
print '</td></tr>';
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';

View File

@ -509,7 +509,35 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
print '<table class="border tableforfield centpercent">';
// Usage
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha')!=''?' checked="checked"':'') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha')!=''?' checked="checked"':'') : ($projectstatic->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha')!=''?' checked="checked"':'') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
print '</td></tr>';
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
@ -554,7 +582,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<tr><td>'.$langs->trans("BillTime").'</td><td>';
print yn($projectstatic->bill_time);
print yn($projectstatic->usage_bill_time);
print '</td></tr>';
}
@ -610,7 +638,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
}
$massactionbutton = '';
if ($projectstatic->bill_time)
if ($projectstatic->usage_bill_time)
{
$arrayofmassactions = array(
'generateinvoice'=>$langs->trans("GenerateBill"),
@ -747,7 +775,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
$arrayfields['t.note']=array('label'=>$langs->trans("Note"), 'checked'=>1);
$arrayfields['t.task_duration']=array('label'=>$langs->trans("Duration"), 'checked'=>1);
$arrayfields['value'] =array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>(empty($conf->salaries->enabled)?0:1));
$arrayfields['valuebilled'] =array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((! empty($conf->global->PROJECT_HIDE_TASKS) || empty($conf->global->PROJECT_BILL_TIME_SPENT))?0:1) && $projectstatic->bill_time));
$arrayfields['valuebilled'] =array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((! empty($conf->global->PROJECT_HIDE_TASKS) || empty($conf->global->PROJECT_BILL_TIME_SPENT))?0:1) && $projectstatic->usage_bill_time));
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
@ -1290,7 +1318,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print '<td class="center">'; // invoice_id and invoice_line_id
if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
if ($projectstatic->bill_time)
if ($projectstatic->usage_bill_time)
{
if ($task_time->invoice_id)
{