NEW Add opportunity amount on project card.
This commit is contained in:
parent
9d1ca52492
commit
5f07c18e06
@ -364,7 +364,7 @@ class FormProjets
|
||||
}
|
||||
// Label for task
|
||||
$labeltoshow.=' - '.$obj->tref.' '.dol_trunc($obj->tlabel,$maxlength);
|
||||
|
||||
|
||||
if (!empty($selected) && $selected == $obj->rowid)
|
||||
{
|
||||
$out.= '<option value="'.$obj->rowid.'" selected';
|
||||
@ -408,8 +408,8 @@ class FormProjets
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Build a HTML select list of element of same thirdparty to suggest to link them to project
|
||||
*
|
||||
@ -467,7 +467,7 @@ class FormProjets
|
||||
$i = 0;
|
||||
if ($num > 0)
|
||||
{
|
||||
$sellist = '<select class="flat" name="elementselect">';
|
||||
$sellist = '<select class="flat elementselect" name="elementselect">';
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
@ -498,4 +498,57 @@ class FormProjets
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build a HTML select list of element of same thirdparty to suggest to link them to project
|
||||
*
|
||||
* @param string $htmlname HTML name
|
||||
* @param int $preselected Preselected
|
||||
* @return int|string The HTML select list of element or '' if nothing or -1 if KO
|
||||
*/
|
||||
function selectOpportunityStatus($htmlname,$preselected=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$sql = "SELECT rowid, ref";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_lead_status';
|
||||
$sql.= " ORDER BY ref DESC";
|
||||
|
||||
dol_syslog(get_class($this).'::selectOpportunityStatus', LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num > 0)
|
||||
{
|
||||
$sellist = '<select class="flat" name="'.$htmlname.'">';
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$sellist .='<option value="'.$obj->rowid.'">'.$ref.'</option>';
|
||||
$i++;
|
||||
}
|
||||
$sellist .='</select>';
|
||||
}
|
||||
/*else
|
||||
{
|
||||
$sellist = '<select class="flat" name="elementselect">';
|
||||
$sellist.= '<option value="0" disabled>'.$langs->trans("None").'</option>';
|
||||
$sellist.= '</select>';
|
||||
}*/
|
||||
$this->db->free($resql);
|
||||
|
||||
return $sellist;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->errors[]=$this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::selectOpportunityStatus " . $this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -340,7 +340,7 @@ function ajax_dialog($title,$message,$w=350,$h=150)
|
||||
* Use ajax_combobox() only for small combo list! If not, use instead ajax_autocompleter().
|
||||
* TODO: It is used when COMPANY_USE_SEARCH_TO_SELECT and CONTACT_USE_SEARCH_TO_SELECT are set by html.formcompany.class.php. Should use ajax_autocompleter instead like done by html.form.class.php for select_produits.
|
||||
*
|
||||
* @param string $htmlname Name of html select field
|
||||
* @param string $htmlname Name of html select field ('myid' or '.myclass')
|
||||
* @param array $events More events option. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
||||
* @param int $minLengthToAutocomplete Minimum length of input string to start autocomplete
|
||||
* @param int $forcefocus Force focus on field
|
||||
|
||||
@ -891,16 +891,17 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta
|
||||
$project_year_filter=0;
|
||||
|
||||
$title=$langs->trans("Project");
|
||||
if ($statut != '' && $statut >= 0) $title=$langs->trans("Project").' ('.$langs->trans($projectstatic->statuts[$statut]).')';
|
||||
if (strcmp($statut, '') && $statut >= 0) $title=$langs->trans("Project").' ('.$langs->trans($projectstatic->statuts[$statut]).')';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($title,"index.php","","","","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print_liste_field_titre($langs->trans("OpportunityStatus"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS)) print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut, COUNT(t.rowid) as nb";
|
||||
$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, COUNT(t.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
if ($mytasks)
|
||||
{
|
||||
@ -966,7 +967,8 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta
|
||||
$projectstatic->ref=$objp->ref;
|
||||
print $projectstatic->getNomUrl(1);
|
||||
print ' - '.dol_trunc($objp->title,24).'</td>';
|
||||
print '<td align="right">'.$objp->nb.'</td>';
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print '<td align="right">'.$objp->fk_opp_status.'</td>';
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS)) print '<td align="right">'.$objp->nb.'</td>';
|
||||
$projectstatic->statut = $objp->fk_statut;
|
||||
print '<td align="right">'.$projectstatic->getLibStatut(3).'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -335,7 +335,8 @@ ALTER TABLE llx_commande_fournisseurdet ADD COLUMN fk_parent_line integer NULL a
|
||||
|
||||
ALTER TABLE llx_projet ADD COLUMN date_close datetime DEFAULT NULL;
|
||||
ALTER TABLE llx_projet ADD COLUMN fk_user_close integer DEFAULT NULL;
|
||||
|
||||
ALTER TABLE llx_projet ADD COLUMN fk_opp_status integer DEFAULT NULL after fk_statut;
|
||||
ALTER TABLE llx_projet ADD COLUMN opp_amount double(24,8) DEFAULT NULL;
|
||||
|
||||
|
||||
-- Module AskPriceSupplier --
|
||||
@ -704,3 +705,13 @@ UPDATE llx_holiday_users SET fk_type = 1 WHERE fk_type IS NULL;
|
||||
UPDATE llx_holiday_logs SET fk_type = 1 WHERE fk_type IS NULL;
|
||||
|
||||
UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_VAT_SOLD_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'ACCOUNTING_VAT_ACCOUNT';
|
||||
|
||||
-- Opportunities status
|
||||
INSERT INTO llx_c_lead_status(rowid,code,label,percent,active) VALUES (1,'PROSP' ,'Prospection',0,1);
|
||||
INSERT INTO llx_c_lead_status(rowid,code,label,percent,active) VALUES (2,'QUAL' ,'Qualification',20,1);
|
||||
INSERT INTO llx_c_lead_status(rowid,code,label,percent,active) VALUES (3,'PROPO' ,'Proposal',40,1);
|
||||
INSERT INTO llx_c_lead_status(rowid,code,label,percent,active) VALUES (4,'NEGO' ,'Negotiation',60,1);
|
||||
INSERT INTO llx_c_lead_status(rowid,code,label,percent,active) VALUES (5,'PENDING','Pending',50,0);
|
||||
INSERT INTO llx_c_lead_status(rowid,code,label,percent,active) VALUES (6,'WIN' ,'Won',100,1);
|
||||
INSERT INTO llx_c_lead_status(rowid,code,label,percent,active) VALUES (7,'LOST' ,'Lost',0,1);
|
||||
|
||||
|
||||
19
htdocs/install/mysql/tables/llx_c_lead_status.key.sql
Normal file
19
htdocs/install/mysql/tables/llx_c_lead_status.key.sql
Normal file
@ -0,0 +1,19 @@
|
||||
-- ========================================================================
|
||||
-- Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- ========================================================================
|
||||
|
||||
ALTER TABLE llx_c_lead_status ADD UNIQUE INDEX uk_c_lead_status_code(code);
|
||||
25
htdocs/install/mysql/tables/llx_c_lead_status.sql
Normal file
25
htdocs/install/mysql/tables/llx_c_lead_status.sql
Normal file
@ -0,0 +1,25 @@
|
||||
-- Manage Lead
|
||||
-- Copyright (C) 2014 Florian HENRY <florian.henry@open-concept.pro>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
create table llx_c_lead_status
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
code varchar(10),
|
||||
label varchar(50),
|
||||
percent double(5,2),
|
||||
active tinyint DEFAULT 1 NOT NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -31,12 +31,14 @@ create table llx_projet
|
||||
description text,
|
||||
fk_user_creat integer NOT NULL, -- createur du projet
|
||||
public integer, -- project is public or not
|
||||
fk_statut smallint DEFAULT 0 NOT NULL,
|
||||
fk_statut integer DEFAULT 0 NOT NULL, -- open or close
|
||||
fk_opp_status integer DEFAULT NULL, -- if project is used to manage opportunities
|
||||
date_close datetime DEFAULT NULL,
|
||||
fk_user_close integer DEFAULT NULL,
|
||||
note_private text,
|
||||
note_public text,
|
||||
--budget_days real, -- budget in days is sum of field planned_workload of tasks
|
||||
opp_amount double(24,8),
|
||||
budget_amount double(24,8),
|
||||
model_pdf varchar(255)
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -121,6 +121,8 @@ ProjectCreatedInDolibarr=Project %s created
|
||||
TaskCreatedInDolibarr=Task %s created
|
||||
TaskModifiedInDolibarr=Task %s modified
|
||||
TaskDeletedInDolibarr=Task %s deleted
|
||||
OpportunityStatus=Opportunity status
|
||||
OpportunityAmount=Apportunity amount
|
||||
##### Types de contacts #####
|
||||
TypeContact_project_internal_PROJECTLEADER=Project leader
|
||||
TypeContact_project_external_PROJECTLEADER=Project leader
|
||||
|
||||
@ -51,7 +51,16 @@ $type='project';
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'updateMask')
|
||||
if ($action == 'setmainoptions')
|
||||
{
|
||||
if (GETPOST('PROJECT_USE_OPPORTUNITIES')) dolibarr_set_const($db, "PROJECT_USE_OPPORTUNITIES",GETPOST('PROJECT_USE_OPPORTUNITIES'),'chaine',0,'',$conf->entity);
|
||||
else dolibarr_del_const($db, "PROJECT_USE_OPPORTUNITIES", $conf->entity);
|
||||
|
||||
if (GETPOST('PROJECT_USE_TASKS')) dolibarr_del_const($db, "PROJECT_HIDE_TASKS", $conf->entity);
|
||||
else dolibarr_set_const($db, "PROJECT_HIDE_TASKS",1,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
else if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstproject=GETPOST('maskconstproject','alpha');
|
||||
$maskproject=GETPOST('maskproject','alpha');
|
||||
@ -281,10 +290,13 @@ else if ($action == 'setmodtask')
|
||||
|
||||
dolibarr_set_const($db, "PROJECT_TASK_ADDON",$value,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
elseif ($action == 'updateoptions') {
|
||||
if (GETPOST('PROJECT_USE_SEARCH_TO_SELECT')) {
|
||||
elseif ($action == 'updateoptions')
|
||||
{
|
||||
if (GETPOST('PROJECT_USE_SEARCH_TO_SELECT'))
|
||||
{
|
||||
$companysearch = GETPOST('activate_PROJECT_USE_SEARCH_TO_SELECT', 'alpha');
|
||||
if (dolibarr_set_const($db, "PROJECT_USE_SEARCH_TO_SELECT", $companysearch, 'chaine', 0, '', $conf->entity)) {
|
||||
if (dolibarr_set_const($db, "PROJECT_USE_SEARCH_TO_SELECT", $companysearch, 'chaine', 0, '', $conf->entity))
|
||||
{
|
||||
$conf->global->PROJECT_USE_SEARCH_TO_SELECT = $companysearch;
|
||||
}
|
||||
}
|
||||
@ -308,6 +320,55 @@ $head=project_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'project', $langs->trans("Projects"), 0, 'project');
|
||||
|
||||
|
||||
|
||||
// Main options
|
||||
$form=new Form($db);
|
||||
$var=true;
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setmainoptions">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print "<td>".$langs->trans("Parameters")."</td>\n";
|
||||
print '<td align="right" width="60">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '<td width="80"> </td></tr>'."\n";
|
||||
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="80%">'.$langs->trans("ManageOpportunitiesStatus").'</td>';
|
||||
print '<td width="60" align="right">';
|
||||
$arrval=array('0'=>$langs->trans("No"),
|
||||
'1'=>$langs->trans("Yes"),
|
||||
);
|
||||
print $form->selectyesno('PROJECT_USE_OPPORTUNITIES', $conf->global->PROJECT_USE_OPPORTUNITIES, 1);
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" name="modifyPROJECT_USE_OPPORTUNITIES" value="'.$langs->trans("Modify").'">';
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="80%">'.$langs->trans("ManageTasks").'</td>';
|
||||
print '<td width="60" align="right">';
|
||||
$arrval=array('0'=>$langs->trans("No"),
|
||||
'1'=>$langs->trans("Yes"),
|
||||
);
|
||||
print $form->selectyesno('PROJECT_USE_TASKS', empty($conf->global->PROJECT_HIDE_TASKS)?1:0, 1);
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" name="modifyPROJECT_USE_TASKS" value="'.$langs->trans("Modify").'">';
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
print '</table></form>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Projects Numbering model
|
||||
*/
|
||||
@ -412,110 +473,115 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
// Task numbering module
|
||||
print_titre($langs->trans("TasksNumberingModules"));
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="100">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("Example").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
|
||||
print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/project/task/");
|
||||
// Task numbering module
|
||||
print_titre($langs->trans("TasksNumberingModules"));
|
||||
|
||||
if (is_dir($dir))
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="100">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("Example").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
|
||||
print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
$dir = dol_buildpath($reldir."core/modules/project/task/");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$var=true;
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
if (preg_match('/^(mod_.*)\.php$/i',$file,$reg))
|
||||
$var=true;
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
$file = $reg[1];
|
||||
$classname = substr($file,4);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
if ($module->isEnabled())
|
||||
if (preg_match('/^(mod_.*)\.php$/i',$file,$reg))
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$module->name."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
$file = $reg[1];
|
||||
$classname = substr($file,4);
|
||||
|
||||
// Show example of numbering module
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
require_once DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$file.'.php';
|
||||
|
||||
print '<td align="center">';
|
||||
if ($conf->global->PROJECT_TASK_ADDON == 'mod_'.$classname)
|
||||
$module = new $file;
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
print img_picto($langs->trans("Activated"),'switch_on');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodtask&value=mod_'.$classname.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$module->name."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
|
||||
$project=new Project($db);
|
||||
$project->initAsSpecimen();
|
||||
// Show example of numbering module
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval=$module->getNextValue($mysoc,$project);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
|
||||
{
|
||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||
if ($nextval)
|
||||
print '<td align="center">';
|
||||
if ($conf->global->PROJECT_TASK_ADDON == 'mod_'.$classname)
|
||||
{
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
print img_picto($langs->trans("Activated"),'switch_on');
|
||||
}
|
||||
else
|
||||
{
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodtask&value=mod_'.$classname.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$project=new Project($db);
|
||||
$project->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval=$module->getNextValue($mysoc,$project);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
|
||||
{
|
||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||
if ($nextval)
|
||||
{
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
/*
|
||||
* Document templates generators
|
||||
*/
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("ProjectsModelModule"));
|
||||
|
||||
@ -668,149 +734,154 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
print '</table><br/>';
|
||||
|
||||
/*
|
||||
* Modeles documents for Task
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("TaskModelModule"));
|
||||
|
||||
// Defini tableau def de modele
|
||||
$type='project_task';
|
||||
$def = array();
|
||||
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = '".$type."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||
{
|
||||
$i = 0;
|
||||
$num_rows=$db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
/*
|
||||
* Modeles documents for Task
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("TaskModelModule"));
|
||||
|
||||
// Defini tableau def de modele
|
||||
$type='project_task';
|
||||
$def = array();
|
||||
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = '".$type."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$array = $db->fetch_array($resql);
|
||||
array_push($def, $array[0]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
print ' <td width="100">'.$langs->trans("Name")."</td>\n";
|
||||
print " <td>".$langs->trans("Description")."</td>\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Activated")."</td>\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
|
||||
print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
$var=true;
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('','/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/project/task/".$valdir);
|
||||
|
||||
if (is_dir($dir))
|
||||
$i = 0;
|
||||
$num_rows=$db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$handle=opendir($dir);
|
||||
if (is_resource($handle))
|
||||
$array = $db->fetch_array($resql);
|
||||
array_push($def, $array[0]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
print ' <td width="100">'.$langs->trans("Name")."</td>\n";
|
||||
print " <td>".$langs->trans("Description")."</td>\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Activated")."</td>\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
|
||||
print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
$var=true;
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach (array('','/doc') as $valdir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/project/task/".$valdir);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
$handle=opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
$filelist[]=$file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach($filelist as $file)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (file_exists($dir.'/'.$file))
|
||||
$filelist[]=$file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach($filelist as $file)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db);
|
||||
|
||||
$modulequalified=1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
|
||||
|
||||
if ($modulequalified)
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr '.$bc[$var].'><td width="100">';
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module,'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
print "</td>\n";
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
|
||||
// Active
|
||||
if (in_array($name, $def))
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=deltask&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||
print '</a>';
|
||||
print "</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=settask&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db);
|
||||
|
||||
// Defaut
|
||||
print "<td align=\"center\">";
|
||||
if ($conf->global->PROJECT_TASK_ADDON_PDF == "$name")
|
||||
{
|
||||
print img_picto($langs->trans("Default"),'on');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoctask&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
$modulequalified=1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
if ($modulequalified)
|
||||
{
|
||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
|
||||
$var = !$var;
|
||||
print '<tr '.$bc[$var].'><td width="100">';
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module,'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
print "</td>\n";
|
||||
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
// Active
|
||||
if (in_array($name, $def))
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=deltask&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||
print '</a>';
|
||||
print "</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=settask&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Preview
|
||||
print '<td align="center">';
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimentask&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
|
||||
// Defaut
|
||||
print "<td align=\"center\">";
|
||||
if ($conf->global->PROJECT_TASK_ADDON_PDF == "$name")
|
||||
{
|
||||
print img_picto($langs->trans("Default"),'on');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoctask&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
|
||||
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
// Preview
|
||||
print '<td align="center">';
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimentask&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_object($langs->trans("PreviewNotAvailable"),'generic');
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_object($langs->trans("PreviewNotAvailable"),'generic');
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -818,9 +889,10 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table><br/>';
|
||||
}
|
||||
|
||||
print '</table><br/>';
|
||||
|
||||
print_titre($langs->trans("Other"));
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
@ -40,6 +41,7 @@ $action=GETPOST('action','alpha');
|
||||
$backtopage=GETPOST('backtopage','alpha');
|
||||
$cancel=GETPOST('cancel','alpha');
|
||||
$status=GETPOST('status','int');
|
||||
$opp_status=GETPOST('opp_status','int');
|
||||
|
||||
if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $action != "update" && ! $_POST["cancel"])) accessforbidden();
|
||||
|
||||
@ -136,11 +138,13 @@ 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->opp_amount = price2num(GETPOST('opp_amount'));
|
||||
$object->budget_amount = price2num(GETPOST('budget_amount'));
|
||||
$object->datec=dol_now();
|
||||
$object->date_start=$date_start;
|
||||
$object->date_end=$date_end;
|
||||
$object->statuts = $status;
|
||||
$object->opp_status = $opp_status;
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
@ -223,9 +227,11 @@ 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;
|
||||
if (isset($_POST['opp_amount'])) $object->opp_amount = price2num(GETPOST('opp_amount'));
|
||||
if (isset($_POST['budget_amount'])) $object->budget_amount= price2num(GETPOST('budget_amount'));
|
||||
if (isset($_POST['opp_status'])) $object->opp_status = $opp_status;
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
@ -379,6 +385,7 @@ if (empty($reshook))
|
||||
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$formproject = new FormProjets($db);
|
||||
$userstatic = new User($db);
|
||||
|
||||
$title=$langs->trans("Project").' - '.$object->ref.' '.$object->name;
|
||||
@ -479,10 +486,21 @@ if ($action == 'create' && $user->rights->projet->creer)
|
||||
print $form->select_date(($date_end?$date_end:-1),'projectend');
|
||||
print '</td></tr>';
|
||||
|
||||
// Opportunity status
|
||||
print '<tr><td>'.$langs->trans("OpportunityStatus").'</td>';
|
||||
print '<td>';
|
||||
print $formproject->selectOpportunityStatus('fk_opp_status',$object->opp_status);
|
||||
print '</tr>';
|
||||
|
||||
// Opportunity amount
|
||||
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td>';
|
||||
print '<td><input size="4" type="text" name="opp_amount" value="'.(GETPOST('opp_amount')!=''?price(GETPOST('opp_amount')):'').'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Budget
|
||||
print '<tr><td>'.$langs->trans("Budget").'</td>';
|
||||
print '<td><input size="4" type="text" name="budget_amount" value="'.(GETPOST('budget_amount')!=''?price(GETPOST('budget_amount')):'').'"></td></tr>';
|
||||
print '</td></tr>';
|
||||
print '<td><input size="4" type="text" name="budget_amount" value="'.(GETPOST('budget_amount')!=''?price(GETPOST('budget_amount')):'').'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Description
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td>';
|
||||
@ -588,11 +606,11 @@ else
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td>';
|
||||
print '<tr><td class="fieldrequired" width="30%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td><input size="12" name="ref" value="'.$object->ref.'"></td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
|
||||
print '<td><input size="40" name="title" value="'.$object->title.'"></td></tr>';
|
||||
|
||||
// Customer
|
||||
@ -626,12 +644,22 @@ else
|
||||
print $form->select_date($object->date_end?$object->date_end:-1,'projectend');
|
||||
print '</td></tr>';
|
||||
|
||||
// Opportunity status
|
||||
print '<tr><td>'.$langs->trans("OpportunityStatus").'</td>';
|
||||
print '<td><input size="4" type="text" name="fk_opp_status" value="'.(isset($_POST['fk_opp_status'])?GETPOST('fk_opp_status'):$object->opp_status).'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Opportunity amount
|
||||
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td>';
|
||||
print '<td><input size="4" type="text" name="opp_amount" value="'.(isset($_POST['opp_amount'])?GETPOST('opp_amount'):(strcmp($object->opp_amount,'')?price($object->opp_amount):'')).'"></td>';
|
||||
print '</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>';
|
||||
print '<td><input size="4" type="text" name="budget_amount" value="'.(isset($_POST['budget_amount'])?GETPOST('budget_amount'):(strcmp($object->budget_amount,'')?price($object->budget_amount):'')).'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Description
|
||||
// Description
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td>';
|
||||
print '<td>';
|
||||
print '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$object->description.'</textarea>';
|
||||
@ -692,9 +720,19 @@ else
|
||||
print dol_print_date($object->date_end,'day');
|
||||
print '</td></tr>';
|
||||
|
||||
// Budget
|
||||
print '<tr><td>'.$langs->trans("OpportunityStatus").'</td><td>';
|
||||
if ($object->fk_opp_status != '') print price($object->fk_opp_status,'',$langs,0,0,0,$conf->currency);
|
||||
print '</td></tr>';
|
||||
|
||||
// Opporutinity Amount
|
||||
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td><td>';
|
||||
if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,0,0,0,$conf->currency);
|
||||
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);
|
||||
if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,0,0,0,$conf->currency);
|
||||
print '</td></tr>';
|
||||
|
||||
// Description
|
||||
|
||||
@ -65,8 +65,11 @@ class Project extends CommonObject
|
||||
var $budget_amount;
|
||||
|
||||
var $statuts_short;
|
||||
var $statuts_long;
|
||||
var $statuts; // 0=draft, 1=opened, 2=closed
|
||||
|
||||
var $opp_status; // opportunity status, into table llx_c_lead_status
|
||||
|
||||
var $oldcopy;
|
||||
|
||||
var $weekWorkLoad; // Used to store workload details of a projet
|
||||
@ -104,7 +107,7 @@ class Project extends CommonObject
|
||||
$this->db = $db;
|
||||
|
||||
$this->statuts_short = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed');
|
||||
$this->statuts = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed');
|
||||
$this->statuts_long = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -140,10 +143,12 @@ class Project extends CommonObject
|
||||
$sql.= ", fk_soc";
|
||||
$sql.= ", fk_user_creat";
|
||||
$sql.= ", fk_statut";
|
||||
$sql.= ", fk_opp_status";
|
||||
$sql.= ", public";
|
||||
$sql.= ", datec";
|
||||
$sql.= ", dateo";
|
||||
$sql.= ", datee";
|
||||
$sql.= ", opp_amount";
|
||||
$sql.= ", budget_amount";
|
||||
$sql.= ", entity";
|
||||
$sql.= ") VALUES (";
|
||||
@ -153,11 +158,13 @@ class Project extends CommonObject
|
||||
$sql.= ", " . ($this->socid > 0 ? $this->socid : "null");
|
||||
$sql.= ", " . $user->id;
|
||||
$sql.= ", ".(is_numeric($this->statuts) ? $this->statuts : '0');
|
||||
$sql.= ", ".(is_numeric($this->opp_status) ? $this->opp_status : 'NULL');
|
||||
$sql.= ", " . ($this->public ? 1 : 0);
|
||||
$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 != '' ? price2num($this->budget_amount) : 'null');
|
||||
$sql.= ", " . (strcmp($this->opp_amount,'') ? price2num($this->opp_amount) : 'null');
|
||||
$sql.= ", " . (strcmp($this->budget_amount,'') ? price2num($this->budget_amount) : 'null');
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
@ -240,13 +247,15 @@ class Project extends CommonObject
|
||||
$sql.= ", description = '" . $this->db->escape($this->description) . "'";
|
||||
$sql.= ", fk_soc = " . ($this->socid > 0 ? $this->socid : "null");
|
||||
$sql.= ", fk_statut = " . $this->statut;
|
||||
$sql.= ", fk_opp_status = " . ($this->opp_status > 0 ? $this->opp_status : 'null');
|
||||
$sql.= ", public = " . ($this->public ? 1 : 0);
|
||||
$sql.= ", datec=" . ($this->date_c != '' ? "'".$this->db->idate($this->date_c)."'" : 'null');
|
||||
$sql.= ", dateo=" . ($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null');
|
||||
$sql.= ", datee=" . ($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null');
|
||||
$sql.= ", date_close=" . ($this->date_close != '' ? "'".$this->db->idate($this->date_close)."'" : 'null');
|
||||
$sql.= ", fk_user_close=" . ($this->fk_user_close > 0 ? $this->fk_user_close : "null");
|
||||
$sql.= ", budget_amount = " . ($this->budget_amount > 0 ? $this->budget_amount : "null");
|
||||
$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.= " WHERE rowid = " . $this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::Update", LOG_DEBUG);
|
||||
@ -332,8 +341,8 @@ class Project extends CommonObject
|
||||
{
|
||||
if (empty($id) && empty($ref)) return -1;
|
||||
|
||||
$sql = "SELECT rowid, ref, title, description, public, datec, budget_amount,";
|
||||
$sql.= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_close, fk_statut, note_private, note_public, model_pdf";
|
||||
$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_close, fk_statut, fk_opp_status, note_private, note_public, model_pdf";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "projet";
|
||||
if (! empty($id))
|
||||
{
|
||||
@ -372,6 +381,8 @@ class Project extends CommonObject
|
||||
$this->user_close_id = $obj->fk_user_close;
|
||||
$this->public = $obj->public;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->opp_status = $obj->fk_opp_status;
|
||||
$this->opp_amount = $obj->opp_amount;
|
||||
$this->budget_amount = $obj->budget_amount;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
|
||||
@ -748,6 +759,11 @@ class Project extends CommonObject
|
||||
$sql.= " AND entity = " . $conf->entity;
|
||||
$sql.= " AND fk_statut = 1";
|
||||
|
||||
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
{
|
||||
// TODO What to do if fk_opp_status is not code 'WIN' or 'LOST'
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::setClose", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -804,7 +820,7 @@ class Project extends CommonObject
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $langs->trans($this->statuts[$statut]);
|
||||
return $langs->trans($this->statuts_long[$statut]);
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
@ -813,38 +829,38 @@ class Project extends CommonObject
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($statut == 0)
|
||||
return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts_short[$statut]);
|
||||
return img_picto($langs->trans($this->statuts_long[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts_short[$statut]);
|
||||
if ($statut == 1)
|
||||
return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4') . ' ' . $langs->trans($this->statuts_short[$statut]);
|
||||
return img_picto($langs->trans($this->statuts_long[$statut]), 'statut4') . ' ' . $langs->trans($this->statuts_short[$statut]);
|
||||
if ($statut == 2)
|
||||
return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_short[$statut]);
|
||||
return img_picto($langs->trans($this->statuts_long[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_short[$statut]);
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($statut == 0)
|
||||
return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0');
|
||||
return img_picto($langs->trans($this->statuts_long[$statut]), 'statut0');
|
||||
if ($statut == 1)
|
||||
return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
|
||||
return img_picto($langs->trans($this->statuts_long[$statut]), 'statut4');
|
||||
if ($statut == 2)
|
||||
return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
|
||||
return img_picto($langs->trans($this->statuts_long[$statut]), 'statut6');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut == 0)
|
||||
return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts_short[$statut]);
|
||||
return img_picto($langs->trans($this->statuts_long[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts_long[$statut]);
|
||||
if ($statut == 1)
|
||||
return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4') . ' ' . $langs->trans($this->statuts_short[$statut]);
|
||||
return img_picto($langs->trans($this->statuts_long[$statut]), 'statut4') . ' ' . $langs->trans($this->statuts_long[$statut]);
|
||||
if ($statut == 2)
|
||||
return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_short[$statut]);
|
||||
return img_picto($langs->trans($this->statuts_long[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_long[$statut]);
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($statut == 0)
|
||||
return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut0');
|
||||
return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_long[$statut]), 'statut0');
|
||||
if ($statut == 1)
|
||||
return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
|
||||
return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_long[$statut]), 'statut4');
|
||||
if ($statut == 2)
|
||||
return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
|
||||
return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_long[$statut]), 'statut6');
|
||||
}
|
||||
}
|
||||
|
||||
@ -914,6 +930,8 @@ class Project extends CommonObject
|
||||
$this->date_m = $now;
|
||||
$this->date_start = $now;
|
||||
$this->note_public = 'SPECIMEN';
|
||||
$this->fk_ele = 20000;
|
||||
$this->opp_amount = 20000;
|
||||
$this->budget_amount = 10000;
|
||||
|
||||
/*
|
||||
|
||||
@ -487,7 +487,6 @@ foreach ($listofreferent as $key => $value)
|
||||
// If we want the project task array to have details of users
|
||||
//if ($key == 'project_task') $key = 'project_task_time';
|
||||
|
||||
|
||||
$element = new $classname($db);
|
||||
|
||||
$addform='';
|
||||
@ -621,7 +620,7 @@ foreach ($listofreferent as $key => $value)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($element instanceof Task)
|
||||
if ($element instanceof Task)
|
||||
{
|
||||
print $element->getNomUrl(1,'withproject','time');
|
||||
print ' - '.dol_trunc($element->label, 48);
|
||||
@ -692,8 +691,8 @@ foreach ($listofreferent as $key => $value)
|
||||
{
|
||||
$tmp = $element->getSumOfAmount($elementuser, $dates, $datee); // $element is a task. $elementuser may be empty
|
||||
$total_ht_by_line = price2num($tmp['amount'],'MT');
|
||||
if ($tmp['nblinesnull'] > 0)
|
||||
{
|
||||
if ($tmp['nblinesnull'] > 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$warning=$langs->trans("WarningSomeLinesWithNullHourlyRate");
|
||||
}
|
||||
@ -810,6 +809,18 @@ foreach ($listofreferent as $key => $value)
|
||||
}
|
||||
}
|
||||
|
||||
// Enhance with select2
|
||||
$nodatarole='';
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$comboenhancement = ajax_combobox('.elementselect');
|
||||
$out.=$comboenhancement;
|
||||
$nodatarole=($comboenhancement?' data-role="none"':'');
|
||||
|
||||
print $comboenhancement;
|
||||
}
|
||||
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user