Debug v18
This commit is contained in:
parent
b4c448a420
commit
a3e4d8fe3a
10 changed files with 47 additions and 43 deletions
|
|
@ -169,7 +169,7 @@ class box_services_contracts extends ModeleBoxes
|
|||
}
|
||||
$description = $objp->description;
|
||||
|
||||
$s = $form->textwithtooltip($text, $description, 3, '', '', '', 0, (!empty($objp->fk_parent_line) ?img_picto('', 'rightarrow') : ''));
|
||||
$s = $form->textwithtooltip($text, $description, 3, '', '', '', 0, '');
|
||||
} else {
|
||||
$s = img_object($langs->trans("ShowProductOrService"), ($objp->product_type ? 'service' : 'product')).' '.dol_htmlentitiesbr($objp->description);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -689,7 +689,7 @@ class FormOther
|
|||
|
||||
$numlines = count($lines);
|
||||
for ($i = 0; $i < $numlines; $i++) {
|
||||
if ($lines[$i]->fk_parent == $parent) {
|
||||
if ($lines[$i]->fk_task_parent == $parent) {
|
||||
//var_dump($selectedproject."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id); // $lines[$i]->id may be empty if project has no lines
|
||||
|
||||
// Break on a new project
|
||||
|
|
@ -729,9 +729,9 @@ class FormOther
|
|||
if (isset($lines[$i]->id)) { // We use isset because $lines[$i]->id may be null if project has no task and are on root project (tasks may be caught by a left join). We enter here only if '0' or >0
|
||||
// Check if we must disable entry
|
||||
$disabled = 0;
|
||||
if ($disablechildoftaskid && (($lines[$i]->id == $disablechildoftaskid || $lines[$i]->fk_parent == $disablechildoftaskid))) {
|
||||
if ($disablechildoftaskid && (($lines[$i]->id == $disablechildoftaskid || $lines[$i]->fk_task_parent == $disablechildoftaskid))) {
|
||||
$disabled++;
|
||||
if ($lines[$i]->fk_parent == $disablechildoftaskid) {
|
||||
if ($lines[$i]->fk_task_parent == $disablechildoftaskid) {
|
||||
$newdisablechildoftaskid = $lines[$i]->id; // If task is child of a disabled parent, we will propagate id to disable next child too
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -903,7 +903,8 @@ class FormTicket
|
|||
$child_id=GETPOST($htmlname.'_child_id', 'aZ09')?GETPOST($htmlname.'_child_id', 'aZ09'):0;
|
||||
if (!empty($groupticket)) {
|
||||
$tmpgroupticket = $groupticket;
|
||||
$sql = "SELECT ctc.rowid, ctc.fk_parent, ctc.code FROM ".$this->db->prefix()."c_ticket_category as ctc WHERE ctc.code = '".$this->db->escape($tmpgroupticket)."'";
|
||||
$sql = "SELECT ctc.rowid, ctc.fk_parent, ctc.code";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_ticket_category as ctc WHERE ctc.code = '".$this->db->escape($tmpgroupticket)."'";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
|
|
|||
|
|
@ -4202,7 +4202,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
|||
'accountancy', 'accounting_account', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset',
|
||||
'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'birthday-cake', 'bookmark', 'bom', 'briefcase-medical', 'bug', 'building',
|
||||
'card', 'calendarlist', 'calendar', 'calendarmonth', 'calendarweek', 'calendarday', 'calendarperuser', 'calendarpertype',
|
||||
'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cross', 'cubes',
|
||||
'cash-register', 'category', 'chart', 'check', 'clock', 'clone', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cross', 'cubes',
|
||||
'currency', 'multicurrency',
|
||||
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'dynamicprice',
|
||||
'edit', 'ellipsis-h', 'email', 'entity', 'envelope', 'eraser', 'establishment', 'expensereport', 'external-link-alt', 'external-link-square-alt', 'eye',
|
||||
|
|
@ -4367,7 +4367,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
|||
// Define $color
|
||||
$arrayconvpictotocolor = array(
|
||||
'address'=>'#6c6aa8', 'building'=>'#6c6aa8', 'bom'=>'#a69944',
|
||||
'cog'=>'#999', 'companies'=>'#6c6aa8', 'company'=>'#6c6aa8', 'contact'=>'#6c6aa8', 'cron'=>'#555',
|
||||
'clone'=>'#999', 'cog'=>'#999', 'companies'=>'#6c6aa8', 'company'=>'#6c6aa8', 'contact'=>'#6c6aa8', 'cron'=>'#555',
|
||||
'dynamicprice'=>'#a69944',
|
||||
'edit'=>'#444', 'note'=>'#999', 'error'=>'', 'help'=>'#bbb', 'listlight'=>'#999', 'language'=>'#555',
|
||||
//'dolly'=>'#a69944', 'dollyrevert'=>'#a69944',
|
||||
|
|
|
|||
|
|
@ -581,7 +581,7 @@ function project_admin_prepare_head()
|
|||
* Show task lines with a particular parent
|
||||
*
|
||||
* @param string $inc Line number (start to 0, then increased by recursive call)
|
||||
* @param string $parent Id of parent project to show (0 to show all)
|
||||
* @param string $parent Id of parent task to show (0 to show all)
|
||||
* @param Task[] $lines Array of lines
|
||||
* @param int $level Level (start to 0, then increased/decrease by recursive call), or -1 to show all level in order of $lines without the recursive groupment feature.
|
||||
* @param string $var Color
|
||||
|
|
@ -629,8 +629,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
|||
|
||||
// Process line
|
||||
// print "i:".$i."-".$lines[$i]->fk_project.'<br>';
|
||||
|
||||
if ($lines[$i]->fk_parent == $parent || $level < 0) { // if $level = -1, we dont' use sublevel recursion, we show all lines
|
||||
if ($lines[$i]->fk_task_parent == $parent || $level < 0) { // if $level = -1, we dont' use sublevel recursion, we show all lines
|
||||
// Show task line.
|
||||
$showline = 1;
|
||||
$showlineingray = 0;
|
||||
|
|
@ -638,7 +637,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
|||
// If there is filters to use
|
||||
if (is_array($taskrole)) {
|
||||
// If task not legitimate to show, search if a legitimate task exists later in tree
|
||||
if (!isset($taskrole[$lines[$i]->id]) && $lines[$i]->id != $lines[$i]->fk_parent) {
|
||||
if (!isset($taskrole[$lines[$i]->id]) && $lines[$i]->id != $lines[$i]->fk_task_parent) {
|
||||
// So search if task has a subtask legitimate to show
|
||||
$foundtaskforuserdeeper = 0;
|
||||
searchTaskInChild($foundtaskforuserdeeper, $lines[$i]->id, $lines, $taskrole);
|
||||
|
|
@ -2447,7 +2446,7 @@ function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole)
|
|||
$numlines = count($lines);
|
||||
for ($i = 0; $i < $numlines; $i++) {
|
||||
// Process line $lines[$i]
|
||||
if ($lines[$i]->fk_parent == $parent && $lines[$i]->id != $lines[$i]->fk_parent) {
|
||||
if ($lines[$i]->fk_task_parent == $parent && $lines[$i]->id != $lines[$i]->fk_task_parent) {
|
||||
// If task is legitimate to show, no more need to search deeper
|
||||
if (isset($taskrole[$lines[$i]->id])) {
|
||||
//print 'Found a legitimate task id='.$lines[$i]->id.'<br>';
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
|||
'task_projectlabel'=>$task->projectlabel,
|
||||
'task_label'=>$task->label,
|
||||
'task_description'=>$task->description,
|
||||
'task_fk_parent'=>$task->fk_parent,
|
||||
'task_fk_parent'=>$task->fk_task_parent,
|
||||
'task_duration'=>$task->duration,
|
||||
'task_duration_hour'=>convertSecondToTime($task->duration, 'all'),
|
||||
'task_planned_workload'=>$task->planned_workload,
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ class doc_generic_task_odt extends ModelePDFTask
|
|||
'task_projectlabel'=>$task->projectlabel,
|
||||
'task_label'=>$task->label,
|
||||
'task_description'=>$task->description,
|
||||
'task_fk_parent'=>$task->fk_parent,
|
||||
'task_fk_parent'=>$task->fk_task_parent,
|
||||
'task_duration'=>$task->duration_effective,
|
||||
'task_duration_formated'=>convertSecondToTime($task->duration_effective, 'allhourmin'),
|
||||
'task_planned_workload'=>$task->planned_workload,
|
||||
|
|
|
|||
|
|
@ -791,7 +791,7 @@ class pdf_standard extends ModelePDFStock
|
|||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
|
||||
// Parent entrepot
|
||||
// Parent warehouse
|
||||
$e = new Entrepot($this->db);
|
||||
$hasparent = (!empty($object->fk_parent) && $e->fetch($object->fk_parent) > 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -145,6 +145,9 @@ class Task extends CommonObjectLine
|
|||
*/
|
||||
public $statuts_short;
|
||||
|
||||
// Properties calculated from sum of llx_element_time linked to task
|
||||
public $tobill;
|
||||
public $billed;
|
||||
|
||||
// Properties to store project informations
|
||||
public $projectref;
|
||||
|
|
@ -155,6 +158,7 @@ class Task extends CommonObjectLine
|
|||
public $fk_opp_status;
|
||||
public $usage_bill_time;
|
||||
public $public;
|
||||
public $array_options_project;
|
||||
|
||||
// Properties to store thirdparty of project information
|
||||
public $socid;
|
||||
|
|
@ -875,7 +879,7 @@ class Task extends CommonObjectLine
|
|||
* @param Extrafields $extrafields Show additional column from project or task
|
||||
* @param int $includebilltime Calculate also the time to bill and billed
|
||||
* @param array $search_array_options Array of search filters. Not Used yet.
|
||||
* @param int $loadextras Fetch all Extrafields on each task
|
||||
* @param int $loadextras Fetch all Extrafields on each project and task
|
||||
* @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
|
|
@ -901,14 +905,11 @@ class Task extends CommonObjectLine
|
|||
$sql .= " t.budget_amount, ";
|
||||
$sql .= " s.rowid as thirdparty_id, s.nom as thirdparty_name, s.email as thirdparty_email,";
|
||||
$sql .= " p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount as project_budget_amount";
|
||||
if (!empty($extrafields->attributes['projet']['label'])) {
|
||||
foreach ($extrafields->attributes['projet']['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes['projet']['type'][$key] != 'separate' ? ",efp.".$key." as options_".$key : '');
|
||||
}
|
||||
}
|
||||
if (!empty($extrafields->attributes['projet_task']['label'])) {
|
||||
foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes['projet_task']['type'][$key] != 'separate' ? ",efpt.".$key." as options_".$key : '');
|
||||
if ($loadextras) { // TODO Replace this with a fetch_optionnal() on the project after the fetch_object of line.
|
||||
if (!empty($extrafields->attributes['projet']['label'])) {
|
||||
foreach ($extrafields->attributes['projet']['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes['projet']['type'][$key] != 'separate' ? ",efp.".$key." as options_".$key : '');
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($includebilltime) {
|
||||
|
|
@ -917,7 +918,9 @@ class Task extends CommonObjectLine
|
|||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_extrafields as efp ON (p.rowid = efp.fk_object)";
|
||||
if ($loadextras) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_extrafields as efp ON (p.rowid = efp.fk_object)";
|
||||
}
|
||||
|
||||
if ($mode == 0) {
|
||||
if ($filteronprojuser > 0) {
|
||||
|
|
@ -932,7 +935,6 @@ class Task extends CommonObjectLine
|
|||
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec2";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2";
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_extrafields as efpt ON (t.rowid = efpt.fk_object)";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('project').")";
|
||||
$sql .= " AND t.fk_projet = p.rowid";
|
||||
} elseif ($mode == 1) {
|
||||
|
|
@ -953,7 +955,6 @@ class Task extends CommonObjectLine
|
|||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_time as tt ON (tt.fk_element = t.rowid AND tt.elementtype = 'task')";
|
||||
}
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_extrafields as efpt ON (t.rowid = efpt.fk_object)";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('project').")";
|
||||
} else {
|
||||
return 'BadValueForParameterMode';
|
||||
|
|
@ -1009,14 +1010,11 @@ class Task extends CommonObjectLine
|
|||
$sql .= " t.budget_amount, ";
|
||||
$sql .= " s.rowid, s.nom, s.email,";
|
||||
$sql .= " p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount";
|
||||
if (!empty($extrafields->attributes['projet']['label'])) {
|
||||
foreach ($extrafields->attributes['projet']['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes['projet']['type'][$key] != 'separate' ? ",efp.".$key : '');
|
||||
}
|
||||
}
|
||||
if (!empty($extrafields->attributes['projet_task']['label'])) {
|
||||
foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes['projet_task']['type'][$key] != 'separate' ? ",efpt.".$key : '');
|
||||
if ($loadextras) {
|
||||
if (!empty($extrafields->attributes['projet']['label'])) {
|
||||
foreach ($extrafields->attributes['projet']['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes['projet']['type'][$key] != 'separate' ? ",efp.".$key : '');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1057,10 +1055,11 @@ class Task extends CommonObjectLine
|
|||
$tasks[$i]->id = $obj->taskid;
|
||||
$tasks[$i]->ref = $obj->taskref;
|
||||
$tasks[$i]->fk_project = $obj->projectid;
|
||||
|
||||
// Data from project
|
||||
$tasks[$i]->projectref = $obj->ref;
|
||||
$tasks[$i]->projectlabel = $obj->plabel;
|
||||
$tasks[$i]->projectstatus = $obj->projectstatus;
|
||||
|
||||
$tasks[$i]->fk_opp_status = $obj->fk_opp_status;
|
||||
$tasks[$i]->opp_amount = $obj->opp_amount;
|
||||
$tasks[$i]->opp_percent = $obj->opp_percent;
|
||||
|
|
@ -1075,6 +1074,7 @@ class Task extends CommonObjectLine
|
|||
$tasks[$i]->planned_workload = $obj->planned_workload;
|
||||
|
||||
if ($includebilltime) {
|
||||
// Data summed from element_time linked to task
|
||||
$tasks[$i]->tobill = $obj->tobill;
|
||||
$tasks[$i]->billed = $obj->billed;
|
||||
}
|
||||
|
|
@ -1091,23 +1091,27 @@ class Task extends CommonObjectLine
|
|||
$tasks[$i]->thirdparty_name = $obj->thirdparty_name;
|
||||
$tasks[$i]->thirdparty_email = $obj->thirdparty_email;
|
||||
|
||||
if (!empty($extrafields->attributes['projet']['label'])) {
|
||||
foreach ($extrafields->attributes['projet']['label'] as $key => $val) {
|
||||
if ($extrafields->attributes['projet']['type'][$key] != 'separate') {
|
||||
$tmpvar = 'options_'.$key;
|
||||
$tasks[$i]->{'options_'.$key} = $obj->$tmpvar;
|
||||
if ($loadextras) {
|
||||
if (!empty($extrafields->attributes['projet']['label'])) {
|
||||
foreach ($extrafields->attributes['projet']['label'] as $key => $val) {
|
||||
if ($extrafields->attributes['projet']['type'][$key] != 'separate') {
|
||||
$tmpvar = 'options_'.$key;
|
||||
$tasks[$i]->array_options_project['options_'.$key] = $obj->$tmpvar;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Removed, already included into the $tasks[$i]->fetch_optionals(); just after
|
||||
if (!empty($extrafields->attributes['projet_task']['label'])) {
|
||||
foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) {
|
||||
if ($extrafields->attributes['projet_task']['type'][$key] != 'separate') {
|
||||
$tmpvar = 'options_'.$key;
|
||||
$tasks[$i]->{'options_'.$key} = $obj->$tmpvar;
|
||||
$tasks[$i]->array_options['options_'.$key] = $obj->$tmpvar;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if ($loadextras) {
|
||||
$tasks[$i]->fetch_optionals();
|
||||
|
|
|
|||
|
|
@ -554,7 +554,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
|
||||
$arrayofmassactions = array();
|
||||
if ($user->hasRight('projet', 'creer')) {
|
||||
$arrayofmassactions['preclonetasks'] = img_picto('', 'rightarrow', 'class="pictofixedwidth"').$langs->trans("Clone");
|
||||
$arrayofmassactions['preclonetasks'] = img_picto('', 'clone', 'class="pictofixedwidth"').$langs->trans("Clone");
|
||||
}
|
||||
if ($permissiontodelete) {
|
||||
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
|
|
|
|||
Loading…
Reference in a new issue