From bcbccf0c83f05d123054d47e69a1a5bb8beeaa76 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 24 Mar 2020 10:32:31 +0100 Subject: [PATCH 01/32] Start working on bom cost --- htdocs/bom/bom_card.php | 3 +++ htdocs/bom/class/bom.class.php | 14 ++++++++++++++ htdocs/bom/tpl/objectline_create.tpl.php | 5 +++++ htdocs/bom/tpl/objectline_title.tpl.php | 9 ++++++--- htdocs/bom/tpl/objectline_view.tpl.php | 5 +++++ 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 81b5f858c9b..c4146660053 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -68,6 +68,7 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view'; // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. +$object->calculateCosts(); // Security check - Protection if external user //if ($user->socid > 0) accessforbidden(); @@ -523,6 +524,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $keyforbreak = 'duration'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + print 'Coût total'.price($object->total_cost).''; + // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index b53e2a7bc88..5e25ef7fb14 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -912,6 +912,7 @@ class BOM extends CommonObject else { $this->lines = $result; + $this->calculateCosts(); return $this->lines; } } @@ -991,6 +992,19 @@ class BOM extends CommonObject return $error; } + + public function calculateCosts() { + include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + $this->total_cost = 0; + foreach ($this->lines as &$line) { + $tmpproduct = new Product($this->db); + $tmpproduct->fetch($line->fk_product); + + $line->unit_cost = $tmpproduct->cost_price; // TODO : add option to work with cost_price or pmp + $line->total_cost = price2num($line->qty * $line->unit_cost); + $this->total_cost += $line->total_cost; + } + } } diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 445466a27a1..66bcf0cece5 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -133,6 +133,11 @@ print ''; print ''; print ''; +$coldisplay++; +print ''; +print ' '; +print ''; + $coldisplay += $colspan; print ''; print ''; diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php index 138a0b9aa58..ce440dbaab6 100644 --- a/htdocs/bom/tpl/objectline_title.tpl.php +++ b/htdocs/bom/tpl/objectline_title.tpl.php @@ -60,13 +60,16 @@ if ($conf->global->PRODUCT_USE_UNITS) } // Qty frozen -print ''.$form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")).''; +print ''.$form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")).''; // Disable stock change -print ''.$form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')).''; +print ''.$form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')).''; // Efficiency -print ''.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).''; +print ''.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).''; + +// Cost +print ''.$langs->trans('CostPrice').''; print ''; // No width to allow autodim diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 16aa5382f53..ad2c2d3e4c6 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -103,6 +103,11 @@ $coldisplay++; echo $line->efficiency; print ''; +print ''; +$coldisplay++; +echo price($line->total_cost); +print ''; + if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines' ) { print ''; $coldisplay++; From 46a4184f15fc38607e2bb4aeeb1413cb1e8821df Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 24 Mar 2020 19:50:01 +0100 Subject: [PATCH 02/32] NEW : Project task list, add column selector and extrafields --- htdocs/core/lib/project.lib.php | 293 +++++++++++++++++------------ htdocs/langs/en_US/projects.lang | 1 + htdocs/projet/class/task.class.php | 16 +- htdocs/projet/tasks.php | 252 +++++++++++++------------ htdocs/projet/tasks/list.php | 65 ++++++- 5 files changed, 379 insertions(+), 248 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index a8af4262d58..2092cfc2b12 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -354,13 +354,17 @@ function project_admin_prepare_head() * @param int $projectidfortotallink 0 or Id of project to use on total line (link to see all time consumed for project) * @param string $filterprogresscalc filter text * @param string $showbilltime Add the column 'TimeToBill' and 'TimeBilled' + * @param array $arrayfields Array with displayed coloumn information * @return int Nb of tasks shown */ -function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '', $showbilltime = 0) +function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '', $showbilltime = 0, $arrayfields=array()) { - global $user, $langs, $conf, $db; + global $user, $langs, $conf, $db, $hookmanager; global $projectstatic, $taskstatic; + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label($taskstatic->table_element); + $lastprojectid = 0; $projectsArrayId = explode(',', $projectsListId); @@ -375,7 +379,6 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } $lines = array_values($lines); } - $numlines = count($lines); // We declare counter as global because we want to edit them into recursive call @@ -487,44 +490,56 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } // Ref of task - print ''; - if ($showlineingray) - { - print ''.img_object('', 'projecttask').' '.$lines[$i]->ref.''; + if (count($arrayfields)>0 && !empty($arrayfields['t.ref']['checked'])) { + print ''; + if ($showlineingray) { + print '' . img_object('', 'projecttask') . ' ' . $lines[$i]->ref . ''; + } else { + print $taskstatic->getNomUrl(1, 'withproject'); + } + print ''; } - else - { - print $taskstatic->getNomUrl(1, 'withproject'); - } - print ''; // Title of task - print ""; - if ($showlineingray) print ''; - //else print ''; - for ($k = 0; $k < $level; $k++) - { - print ''; + + if (count($arrayfields)>0 && !empty($arrayfields['t.description']['checked'])) { + print ""; + print $lines[$i]->description; + print "\n"; } - if ($showlineingray) print ''; - //else print ''; - print "\n"; // Date start - print ''; - print dol_print_date($lines[$i]->date_start, 'dayhour'); - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.dateo']['checked'])) { + print ''; + print dol_print_date($lines[$i]->date_start, 'dayhour'); + print ''; + } // Date end - print ''; - print dol_print_date($lines[$i]->date_end, 'dayhour'); - if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late")); - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.datee']['checked'])) { + print ''; + print dol_print_date($lines[$i]->date_end, 'dayhour'); + if ($taskstatic->hasDelay()) + print img_warning($langs->trans("Late")); + print ''; + } $plannedworkloadoutputformat = 'allhourmin'; $timespentoutputformat = 'allhourmin'; @@ -532,79 +547,88 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT; // Planned Workload (in working hours) - print ''; - $fullhour = convertSecondToTime($lines[$i]->planned_workload, $plannedworkloadoutputformat); - $workingdelay = convertSecondToTime($lines[$i]->planned_workload, 'all', 86400, 7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks - if ($lines[$i]->planned_workload != '') - { - print $fullhour; - // TODO Add delay taking account of working hours per day and working day per week - //if ($workingdelay != $fullhour) print '
('.$workingdelay.')'; + if (count($arrayfields)>0 && !empty($arrayfields['t.planned_workload']['checked'])) { + print ''; + $fullhour = convertSecondToTime($lines[$i]->planned_workload, $plannedworkloadoutputformat); + $workingdelay = convertSecondToTime($lines[$i]->planned_workload, 'all', 86400, 7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks + if ($lines[$i]->planned_workload != '') { + print $fullhour; + // TODO Add delay taking account of working hours per day and working day per week + //if ($workingdelay != $fullhour) print '
('.$workingdelay.')'; + } + //else print '--:--'; + print ''; } - //else print '--:--'; - print ''; // Time spent - print ''; - if ($showlineingray) print ''; - else print ''; - if ($lines[$i]->duration) print convertSecondToTime($lines[$i]->duration, $timespentoutputformat); - else print '--:--'; - if ($showlineingray) print ''; - else print ''; - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.duration_effective']['checked'])) { + print ''; + if ($showlineingray) + print ''; + else print ''; + if ($lines[$i]->duration) + print convertSecondToTime($lines[$i]->duration, $timespentoutputformat); + else print '--:--'; + if ($showlineingray) + print ''; + else print ''; + print ''; + } // Progress calculated (Note: ->duration is time spent) - print ''; - if ($lines[$i]->planned_workload || $lines[$i]->duration) - { - if ($lines[$i]->planned_workload) print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload, 2).' %'; - else print ''.$langs->trans('WorkloadNotDefined').''; + if (count($arrayfields)>0 && !empty($arrayfields['t.progress_calculated']['checked'])) { + print ''; + if ($lines[$i]->planned_workload || $lines[$i]->duration) { + if ($lines[$i]->planned_workload) + print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload, 2) . ' %'; + else print '' . $langs->trans('WorkloadNotDefined') . ''; + } + print ''; } - print ''; // Progress declared - print ''; - if ($lines[$i]->progress != '') - { - print getTaskProgressBadge($taskstatic); + if (count($arrayfields)>0 && !empty($arrayfields['t.progress']['checked'])) { + print ''; + if ($lines[$i]->progress != '') { + print getTaskProgressBadge($taskstatic); + } + print ''; } - print ''; // resume - print ''; - if ($lines[$i]->progress != '' && $lines[$i]->duration) { - print getTaskProgressView($taskstatic, false, false); - } - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.progress_summary']['checked'])) { + print ''; + if ($lines[$i]->progress != '' && $lines[$i]->duration) { + print getTaskProgressView($taskstatic, false, false); + } + print ''; + } if ($showbilltime) { // Time not billed - print ''; - if ($lines[$i]->usage_bill_time) - { - print convertSecondToTime($lines[$i]->tobill, 'allhourmin'); - $total_projectlinesa_tobill += $lines[$i]->tobill; - } - else - { - print ''.$langs->trans("NA").''; - } - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.tobill']['checked'])) { + print ''; + if ($lines[$i]->usage_bill_time) { + print convertSecondToTime($lines[$i]->tobill, 'allhourmin'); + $total_projectlinesa_tobill += $lines[$i]->tobill; + } else { + print '' . $langs->trans("NA") . ''; + } + print ''; + } // Time billed - print ''; - if ($lines[$i]->usage_bill_time) - { - print convertSecondToTime($lines[$i]->billed, 'allhourmin'); - $total_projectlinesa_billed += $lines[$i]->billed; - } - else - { - print ''.$langs->trans("NA").''; - } - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.billed']['checked'])) { + print ''; + if ($lines[$i]->usage_bill_time) { + print convertSecondToTime($lines[$i]->billed, 'allhourmin'); + $total_projectlinesa_billed += $lines[$i]->billed; + } else { + print '' . $langs->trans("NA") . ''; + } + print ''; + } } // Contacts of task @@ -628,6 +652,15 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''; } + // Extra fields + $extrafieldsobjectkey=$taskstatic->table_element; + $obj=$lines[$i]; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$lines[$i]); + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Tick to drag and drop if ($addordertick) { @@ -641,7 +674,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t if ($level >= 0) // Call sublevels { $level++; - if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick, $projectidfortotallink, $filterprogresscalc, $showbilltime); + if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick, $projectidfortotallink, $filterprogresscalc, $showbilltime, $arrayfields); $level--; } @@ -663,17 +696,23 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''; print ''.$langs->trans("Total").''; if ($showproject) print ''; - print ''; - print ''; - print ''; - print ''; - print convertSecondToTime($total_projectlinesa_planned, 'allhourmin'); - print ''; - print ''; - if ($projectidfortotallink > 0) print ''; - print convertSecondToTime($total_projectlinesa_spent, 'allhourmin'); - if ($projectidfortotallink > 0) print ''; - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.label']['checked'])) print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.dateo']['checked'])) print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.datee']['checked'])) print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.planned_workload']['checked'])) { + print ''; + print convertSecondToTime($total_projectlinesa_planned, 'allhourmin'); + print ''; + } + if (count($arrayfields)>0 && !empty($arrayfields['t.duration_effective']['checked'])) { + print ''; + if ($projectidfortotallink > 0) + print ''; + print convertSecondToTime($total_projectlinesa_spent, 'allhourmin'); + if ($projectidfortotallink > 0) + print ''; + print ''; + } if ($total_projectlinesa_planned) { $totalAverageDeclaredProgress = round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2); @@ -698,33 +737,45 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } } - print ''; - if ($total_projectlinesa_planned) print $totalCalculatedProgress.' %'; - print ''; - print ''; - if ($total_projectlinesa_planned) print ''.$totalAverageDeclaredProgress.' %'; - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.progress_calculated']['checked'])) { + print ''; + if ($total_projectlinesa_planned) + print $totalCalculatedProgress . ' %'; + print ''; + } + if (count($arrayfields)>0 && !empty($arrayfields['t.progress']['checked'])) { + print ''; + if ($total_projectlinesa_planned) + print '' . $totalAverageDeclaredProgress . ' %'; + print ''; + } // resume - print ''; - if ($total_projectlinesa_planned) { - print ''; - print '
'; - print '
'; - print '
'; - print ''; - } - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.progress_summary']['checked'])) { + print ''; + if ($total_projectlinesa_planned) { + print ''; + print '
'; + print '
'; + print '
'; + print ''; + } + print ''; + } if ($showbilltime) { - print ''; - print convertSecondToTime($total_projectlinesa_tobill, 'allhourmin'); - print ''; - print ''; - print convertSecondToTime($total_projectlinesa_billed, 'allhourmin'); - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.tobill']['checked'])) { + print ''; + print convertSecondToTime($total_projectlinesa_tobill, 'allhourmin'); + print ''; + } + if (count($arrayfields)>0 && !empty($arrayfields['t.billed']['checked'])) { + print ''; + print convertSecondToTime($total_projectlinesa_billed, 'allhourmin'); + print ''; + } } // Contacts of task if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 94e440f9ab9..90020935390 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -265,3 +265,4 @@ InvoiceToUse=Draft invoice to use NewInvoice=New invoice OneLinePerTask=One line per task OneLinePerPeriod=One line per period +RefTaskParent=Ref. Parent Task diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 613daa18ab0..7bb3f55242d 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -740,11 +740,12 @@ class Task extends CommonObject * @param string $filterontaskuser Filter on user assigned to task * @param array $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 * @return array Array of tasks */ - public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0) + public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options=array()) { - global $conf; + global $conf, $hookmanager; $tasks = array(); @@ -756,6 +757,7 @@ class Task extends CommonObject $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 .= " t.description, "; $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"; if (!empty($extrafields->attributes['projet']['label'])) @@ -850,12 +852,21 @@ class Task extends CommonObject if ($filteronproj) $sql .= natural_search(array("p.ref", "p.title"), $filteronproj); if ($filteronprojstatus && $filteronprojstatus != '-1') $sql .= " AND p.fk_statut IN (".$filteronprojstatus.")"; if ($morewherefilter) $sql .= $morewherefilter; + // Add where from extra fields + $extrafieldsobjectkey='projet_task'; + $extrafieldsobjectprefix='efpt.'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; + // Add where from hooks + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook + $sql .= $hookmanager->resPrint; if ($includebilltime) { $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,"; + $sql .= " t.description, "; $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'])) @@ -868,6 +879,7 @@ class Task extends CommonObject } } + $sql .= " ORDER BY p.ref, t.rang, t.dateo"; //print $sql;exit; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index b125ed7306e..7082e68d97d 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -52,6 +52,7 @@ $cancel = GETPOST('cancel', 'alpha'); $search_user_id = GETPOST('search_user_id', 'int'); $search_taskref = GETPOST('search_taskref'); $search_tasklabel = GETPOST('search_tasklabel'); +$search_taskdescription=GETPOST('search_taskdescription'); $search_dtstartday = GETPOST('search_dtstartday'); $search_dtstartmonth = GETPOST('search_dtstartmonth'); $search_dtstartyear = GETPOST('search_dtstartyear'); @@ -63,6 +64,8 @@ $search_timespend = GETPOST('search_timespend'); $search_progresscalc = GETPOST('search_progresscalc'); $search_progressdeclare = GETPOST('search_progressdeclare'); +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'projecttasklist'; + //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects $object = new Project($db); @@ -78,6 +81,7 @@ if ($id > 0 || !empty($ref)) $extrafields->fetch_name_optionals_label($object->table_element); } $extrafields->fetch_name_optionals_label($taskstatic->table_element); +$search_array_options = $extrafields->getOptionalsFromPost($taskstatic->table_element, '', 'search_'); // Security check $socid = 0; @@ -96,37 +100,38 @@ $planned_workloadhour = (GETPOST('planned_workloadhour', 'int') ?GETPOST('planne $planned_workloadmin = (GETPOST('planned_workloadmin', 'int') ?GETPOST('planned_workloadmin', 'int') : 0); $planned_workload = $planned_workloadhour * 3600 + $planned_workloadmin * 60; +// Definition of fields for list $arrayfields = array( - 't.ref'=>array('label'=>$langs->trans("RefTask"), 'checked'=>1, 'position'=>80), - 't.label'=>array('label'=>$langs->trans("LabelTask"), 'checked'=>1, 'position'=>80), - 't.dateo'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>100), - 't.datee'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>101), - 'p.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>1), - 'p.title'=>array('label'=>$langs->trans("ProjectLabel"), 'checked'=>0), - 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>0), - 'p.fk_statut'=>array('label'=>$langs->trans("ProjectStatus"), 'checked'=>1), - 't.planned_workload'=>array('label'=>$langs->trans("PlannedWorkload"), 'checked'=>1, 'position'=>102), - 't.duration_effective'=>array('label'=>$langs->trans("TimeSpent"), 'checked'=>1, 'position'=>103), - 't.progress_calculated'=>array('label'=>$langs->trans("ProgressCalculated"), 'checked'=>1, 'position'=>104), - 't.progress'=>array('label'=>$langs->trans("ProgressDeclared"), 'checked'=>1, 'position'=>105), - 't.tobill'=>array('label'=>$langs->trans("TimeToBill"), 'checked'=>0, 'position'=>110), - 't.billed'=>array('label'=>$langs->trans("TimeBilled"), 'checked'=>0, 'position'=>111), - 't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), - 't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), - //'t.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), + 't.ref'=>array('label'=>$langs->trans("RefTask"), 'checked'=>1, 'position'=>1), + 't.label'=>array('label'=>$langs->trans("LabelTask"), 'checked'=>1, 'position'=>2), + 't.description'=>array('label'=>$langs->trans("Description"), 'checked'=>0, 'position'=>3), + 't.dateo'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>4), + 't.datee'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>5), + 't.planned_workload'=>array('label'=>$langs->trans("PlannedWorkload"), 'checked'=>1, 'position'=>6), + 't.duration_effective'=>array('label'=>$langs->trans("TimeSpent"), 'checked'=>1, 'position'=>7), + 't.progress_calculated'=>array('label'=>$langs->trans("ProgressCalculated"), 'checked'=>1, 'position'=>8), + 't.progress'=>array('label'=>$langs->trans("ProgressDeclared"), 'checked'=>1, 'position'=>9), + 't.progress_summary'=>array('label'=>$langs->trans("TaskProgressSummary"), 'checked'=>1, 'position'=>10), + 't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), ); -// Extra fields project -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) +if ($object->usage_bill_time) { + $arrayfields['t.tobill']=array('label'=>$langs->trans("TimeToBill"), 'checked'=>0, 'position'=>11); + $arrayfields['t.billed']=array('label'=>$langs->trans("TimeBilled"), 'checked'=>0, 'position'=>12); +} + +// Extra fields +if (is_array($extrafields->attributes[$taskstatic->table_element]['label']) && count($extrafields->attributes[$taskstatic->table_element]['label']) > 0) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) + foreach ($extrafields->attributes[$taskstatic->table_element]['label'] as $key => $val) { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); + if (!empty($extrafields->attributes[$taskstatic->table_element]['list'][$key])) + $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$taskstatic->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$taskstatic->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$taskstatic->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$taskstatic->table_element]['list'][$key]) != 3 && $extrafields->attributes[$taskstatic->table_element]['perms'][$key])); } } -$object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; /* * Actions @@ -204,7 +209,6 @@ if (!empty($search_progressdeclare)) { $morewherefilterarray[] = natural_search('t.progress', $search_progressdeclare, 1, 1); } - $morewherefilter = ''; if (count($morewherefilterarray) > 0) { $morewherefilter = ' AND '.implode(' AND ', $morewherefilterarray); @@ -332,21 +336,18 @@ $projectstatic = new Project($db); $taskstatic = new Task($db); $userstatic = new User($db); -$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - $title = $langs->trans("Project").' - '.$langs->trans("Tasks").' - '.$object->ref.' '.$object->name; if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->ref.' '.$object->name.' - '.$langs->trans("Tasks"); $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; llxHeader("", $title, $help_url); + if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); $object->fetch_thirdparty(); $res = $object->fetch_optionals(); - // To verify role of users //$userAccess = $object->restrictedProjectArea($user,'read'); $userWrite = $object->restrictedProjectArea($user, 'write'); @@ -359,8 +360,25 @@ if ($id > 0 || !empty($ref)) $head = project_prepare_head($object); dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($object->public ? 'projectpub' : 'project')); - $param = ''; - if ($search_user_id > 0) $param .= '&search_user_id='.dol_escape_htmltag($search_user_id); + $param = 'id='.$object->id; + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); + if ($search_user_id) $param .= '&search_user_id='.urlencode($search_user_id); + if ($search_taskref) $param .= '&search_taskref='.urlencode($search_taskref); + if ($search_tasklabel) $param .= '&search_tasklabel='.urlencode($search_tasklabel); + if ($search_taskdescription) $param .= '&search_taskdescription='.urlencode($search_taskdescription); + if ($search_dtstartday) $param .= '&search_dtstartday='.urlencode($search_dtstartday); + if ($search_dtstartmonth) $param .= '&search_dtstartmonth='.urlencode($search_dtstartmonth); + if ($search_dtstartyear) $param .= '&search_dtstartyear='.urlencode($search_dtstartyear); + if ($search_dtendday) $param .= '&search_dtendday='.urlencode($search_dtendday); + if ($search_dtendmonth) $param .= '&search_dtendmonth='.urlencode($search_dtendmonth); + if ($search_dtendyear) $param .= '&search_dtendyear='.urlencode($search_dtendyear); + if ($search_planedworkload) $param .= '&search_planedworkload='.urlencode($search_planedworkload); + if ($search_timespend) $param .= '&search_timespend='.urlencode($search_timespend); + if ($search_progresscalc) $param .= '&search_progresscalc='.urlencode($search_progresscalc); + if ($search_progressdeclare) $param .= '&search_progressdeclare='.urlencode($search_progressdeclare); + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); + // Add $param from extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Project card @@ -425,25 +443,6 @@ if ($id > 0 || !empty($ref)) else print $langs->trans('PrivateProject'); print ''; - /*if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) - { - // Opportunity status - print ''.$langs->trans("OpportunityStatus").''; - $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); - if ($code) print $langs->trans("OppStatus".$code); - print ''; - - // Opportunity percent - print ''.$langs->trans("OpportunityProbability").''; - if (strcmp($object->opp_percent,'')) print price($object->opp_percent,'',$langs,1,0).' %'; - print ''; - - // Opportunity Amount - print ''.$langs->trans("OpportunityAmount").''; - if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,1,0,0,$conf->currency); - print ''; - }*/ - // Date start - end print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; $start = dol_print_date($object->date_start, 'day'); @@ -618,27 +617,12 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third } elseif ($id > 0 || !empty($ref)) { + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + /* * Projet card in view mode */ - // Definition of fields for list - $arrayfields = array(); - $arrayfields['t.task_ref'] = array('label'=>$langs->trans("RefTask"), 'checked'=>1); - $arrayfields['t.task_label'] = array('label'=>$langs->trans("LabelTask"), 'checked'=>1); - $arrayfields['t.task_date_start'] = array('label'=>$langs->trans("DateStart"), 'checked'=>1); - $arrayfields['t.task_date_end'] = array('label'=>$langs->trans("DateEnd"), 'checked'=>1); - // Extra fields - if (is_array($extrafields->attributes[$taskstatic->table_element]['label']) && count($extrafields->attributes[$taskstatic->table_element]['label']) > 0) - { - foreach ($extrafields->attributes[$taskstatic->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$taskstatic->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$taskstatic->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$taskstatic->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$taskstatic->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$taskstatic->table_element]['list'][$key]) != 3 && $extrafields->attributes[$taskstatic->table_element]['perms'][$key])); - } - } - $arrayfields = dol_sort_array($arrayfields, 'position'); - print '
'; // Link to create task @@ -654,7 +638,6 @@ elseif ($id > 0 || !empty($ref)) $linktocreatetask = dolGetButtonTitle($langs->trans('AddTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id.'&action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id), '', $linktocreatetaskUserRight, $linktocreatetaskParam); - print '
'; if ($optioncss != '') print ''; print ''; @@ -674,7 +657,7 @@ elseif ($id > 0 || !empty($ref)) // Get list of tasks in tasksarray and taskarrayfiltered // We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him). $filteronthirdpartyid = $socid; - $tasksarray = $taskstatic->getTasksArray(0, 0, $object->id, $filteronthirdpartyid, 0, '', -1, $morewherefilter, 0, 0, array(), 1); + $tasksarray = $taskstatic->getTasksArray(0, 0, $object->id, $filteronthirdpartyid, 0, '', -1, $morewherefilter, 0, 0, $extrafields, 1, $search_array_options); // We load also tasks limited to a particular user $tmpuser = new User($db); if ($search_user_id > 0) $tmpuser->fetch($search_user_id); @@ -704,64 +687,90 @@ elseif ($id > 0 || !empty($ref)) print ''; } - $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - print '
'; print ''; // Fields title search print ''; - print ''; + if (!empty($arrayfields['t.ref']['checked'])) { + print ''; + } - print ''; + if (!empty($arrayfields['t.label']['checked'])) { + print ''; + } - print ''; + if (!empty($arrayfields['t.description']['checked'])) { + print ''; + } - print ''; + if (!empty($arrayfields['t.dateo']['checked'])) { + print ''; + } - print ''; + if (!empty($arrayfields['t.datee']['checked'])) { + print ''; + } - print ''; + if (!empty($arrayfields['t.planned_workload']['checked'])) { + print ''; + } - print ''; + if (!empty($arrayfields['t.duration_effective']['checked'])) { + print ''; + } - print ''; + if (!empty($arrayfields['t.progress_calculated']['checked'])) { + print ''; + } + + if (!empty($arrayfields['t.progress']['checked'])) { + print ''; + } // progress resume not searchable print ''; if ($object->usage_bill_time) { - print ''; + if (!empty($arrayfields['t.tobill']['checked'])) { + print ''; + } - print ''; + if (!empty($arrayfields['t.billed']['checked'])) { + print ''; + } } - if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print ''; + if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print ''; + + $extrafieldsobjectkey=$taskstatic->table_element; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Action column print ''; // print ''; - print_liste_field_titre("RefTask", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, ''); - print_liste_field_titre("LabelTask", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, ''); - print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center '); - print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center '); - print_liste_field_titre("PlannedWorkload", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("TimeSpent", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); - 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 (!empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, ''); + if (!empty($arrayfields['t.label']['checked'])) print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, ''); + if (!empty($arrayfields['t.description']['checked'])) print_liste_field_titre($arrayfields['t.description']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, ''); + if (!empty($arrayfields['t.dateo']['checked'])) print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['t.datee']['checked'])) print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['t.planned_workload']['checked'])) print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + if (!empty($arrayfields['t.duration_effective']['checked'])) print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + if (!empty($arrayfields['t.progress_calculated']['checked'])) print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + if (!empty($arrayfields['t.progress']['checked'])) print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + if (!empty($arrayfields['t.progress_summary']['checked'])) print_liste_field_titre($arrayfields['t.progress_summary']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center '); 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 '); + if (!empty($arrayfields['t.tobill']['checked'])) print_liste_field_titre($arrayfields['t.tobill']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + if (!empty($arrayfields['t.billed']['checked'])) print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); } - if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print_liste_field_titre("TaskRessourceLinks", $_SERVER["PHP_SELF"], '', '', '', $sortfield, $sortorder); - print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); + if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print_liste_field_titre("TaskRessourceLinks", $_SERVER["PHP_SELF"], '', '', $param, $sortfield, $sortorder); + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; + // Hook fields + $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; if (count($tasksarray) > 0) { // 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->usage_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), $arrayfields); } else { diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 09135733e9e..aa4bfad01f1 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -56,6 +56,7 @@ $search_project_title = GETPOST('search_project_title'); $search_task_ref = GETPOST('search_task_ref'); $search_task_label = GETPOST('search_task_label'); $search_task_description = GETPOST('search_task_description'); +$search_task_ref_parent = GETPOST('search_task_ref_parent'); $search_project_user = GETPOST('search_project_user'); $search_task_user = GETPOST('search_task_user'); @@ -109,8 +110,10 @@ $fieldstosearchall = array( if (empty($user->socid)) $fieldstosearchall['t.note_private'] = "NotePrivate"; $arrayfields = array( + 't.fk_task_parent'=>array('label'=>$langs->trans("RefTaskParent"), 'checked'=>0, 'position'=>70), 't.ref'=>array('label'=>$langs->trans("RefTask"), 'checked'=>1, 'position'=>80), 't.label'=>array('label'=>$langs->trans("LabelTask"), 'checked'=>1, 'position'=>80), + 't.description'=>array('label'=>$langs->trans("Description"), 'checked'=>0, 'position'=>80), 't.dateo'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>100), 't.datee'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>101), 'p.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>1), @@ -169,6 +172,7 @@ if (empty($reshook)) $search_task_ref = ""; $search_task_label = ""; $search_task_description = ""; + $search_task_ref_parent = ""; $search_task_user = -1; $search_project_user = -1; $search_sday = ''; @@ -262,7 +266,8 @@ $distinct = 'DISTINCT'; // We add distinct until we are added a protection to be $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"; +$sql .= " t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut, "; +$sql .= " t.description, t.fk_task_parent"; // We'll need these fields in order to filter by categ if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_project"; // Add sum fields @@ -302,6 +307,8 @@ if ($search_project_ref) $sql .= natural_search('p.ref', $search_project_ref); if ($search_project_title) $sql .= natural_search('p.title', $search_project_title); if ($search_task_ref) $sql .= natural_search('t.ref', $search_task_ref); if ($search_task_label) $sql .= natural_search('t.label', $search_task_label); +if ($search_task_description) $sql .= natural_search('t.description', $search_task_description); +if ($search_task_ref_parent) $sql .= ' AND t.fk_task_parent IN (SELECT ipt.rowid FROM '.MAIN_DB_PREFIX.'projet_task as ipt WHERE '.natural_search('ipt.ref', $search_task_ref_parent, 0, 1).')'; if ($search_societe) $sql .= natural_search('s.nom', $search_societe); $sql .= dolSqlDateFilter('t.dateo', $search_sday, $search_smonth, $search_syear); $sql .= dolSqlDateFilter('t.datee', $search_eday, $search_emonth, $search_eyear); @@ -385,8 +392,10 @@ if ($socid) $param .= '&socid='.urlencode($socid); if ($search_all != '') $param .= '&search_all='.urlencode($search_all); if ($search_project_ref != '') $param .= '&search_project_ref='.urlencode($search_project_ref); if ($search_project_title != '') $param .= '&search_project_title='.urlencode($search_project_title); -if ($search_ref != '') $param .= '&search_ref='.urlencode($search_ref); -if ($search_label != '') $param .= '&search_label='.urlencode($search_label); +if ($search_task_ref != '') $param .= '&search_task_ref='.urlencode($search_ref); +if ($search_task_label != '') $param .= '&search_task_label='.urlencode($search_label); +if ($search_task_description != '') $param .= '&search_task_description='.urlencode($search_description); +if ($search_task_ref_parent != '') $param .= '&search_task_ref_parent='.urlencode($search_task_ref_parent); if ($search_societe != '') $param .= '&search_societe='.urlencode($search_societe); if ($search_projectstatus != '') $param .= '&search_projectstatus='.urlencode($search_projectstatus); if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all', 'none'))) $param .= '&search_opp_status='.urlencode($search_opp_status); @@ -491,6 +500,12 @@ print '
'; print '
'; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; - $formother->select_year($search_dtstartyear ? $search_dtstartyear : -1, 'search_dtstartyear', 1, 20, 5); - print ''; + print ''; + print ''; - print ''; - print ''; - $formother->select_year($search_dtendyear ? $search_dtendyear : -1, 'search_dtendyear', 1, 20, 5); - print ''; + print ''; + print ''; + $formother->select_year($search_dtstartyear ? $search_dtstartyear : -1, 'search_dtstartyear', 1, 20, 5); + print ''; - print ''; - print ''; + print ''; + print ''; + $formother->select_year($search_dtendyear ? $search_dtendyear : -1, 'search_dtendyear', 1, 20, 5); + print ''; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; - print ''; + print ''; - print ''; + print ''; @@ -772,29 +781,36 @@ elseif ($id > 0 || !empty($ref)) print '
'.$langs->trans("Project").'
'."\n"; print ''; +if (!empty($arrayfields['t.fk_task_parent']['checked'])) +{ + print ''; +} if (!empty($arrayfields['t.ref']['checked'])) { print ''; } +//Task Description +if (!empty($arrayfields['t.description']['checked'])) +{ + print ''; +} // Start date if (!empty($arrayfields['t.dateo']['checked'])) { @@ -581,17 +603,19 @@ print ''; print "\n"; print ''; +if (!empty($arrayfields['t.fk_task_parent']['checked'])) print_liste_field_titre($arrayfields['t.fk_task_parent']['label'], $_SERVER["PHP_SELF"], "t.fk_task_parent", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['t.label']['checked'])) print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER["PHP_SELF"], "t.label", "", $param, "", $sortfield, $sortorder); -if (!empty($arrayfields['t.dateo']['checked'])) print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "t.dateo", "", $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['t.description']['checked'])) print_liste_field_titre($arrayfields['t.description']['label'], $_SERVER["PHP_SELF"], "t.description", "", $param, "", $sortfield, $sortorder); +if (!empty($arrayfields['t.dateo']['checked'])) print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "t.dateo", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['t.datee']['checked'])) print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "t.datee", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['p.title']['checked'])) print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER["PHP_SELF"], "p.title", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); -if (!empty($arrayfields['t.planned_workload']['checked'])) print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "t.planned_workload", "", $param, '', $sortfield, $sortorder, 'center '); -if (!empty($arrayfields['t.duration_effective']['checked'])) print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "t.duration_effective", "", $param, '', $sortfield, $sortorder, 'center '); -if (!empty($arrayfields['t.progress_calculated']['checked'])) print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center '); +if (!empty($arrayfields['t.planned_workload']['checked'])) print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "t.planned_workload", "", $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['t.duration_effective']['checked'])) print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "t.duration_effective", "", $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['t.progress_calculated']['checked'])) print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center '); if (!empty($arrayfields['t.progress']['checked'])) print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "t.progress", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['t.progress_summary']['checked'])) print_liste_field_titre($arrayfields['t.progress_summary']['label'], $_SERVER["PHP_SELF"], "t.progress", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['t.tobill']['checked'])) print_liste_field_titre($arrayfields['t.tobill']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center '); @@ -622,12 +646,14 @@ while ($i < min($num, $limit)) $object->id = $obj->id; $object->ref = $obj->ref; $object->label = $obj->label; + $object->description = $obj->description; $object->fk_statut = $obj->fk_statut; $object->progress = $obj->progress; $object->datee = $db->jdate($obj->date_end); // deprecated $object->date_end = $db->jdate($obj->date_end); $object->planned_workload = $obj->planned_workload; $object->duration_effective = $obj->duration_effective; + $object->fk_task_parent = $obj->fk_task_parent; $projectstatic->id = $obj->projectid; @@ -642,6 +668,23 @@ while ($i < min($num, $limit)) { print ''; + // Ref Parent + if (!empty($arrayfields['t.fk_task_parent']['checked'])) { + print ''; + if (!$i) $totalarray['nbfield']++; + } // Ref if (!empty($arrayfields['t.ref']['checked'])) { @@ -659,6 +702,14 @@ while ($i < min($num, $limit)) print ''; if (!$i) $totalarray['nbfield']++; } + // Description + if (!empty($arrayfields['t.description']['checked'])) + { + print ''; + if (!$i) $totalarray['nbfield']++; + } // Date start if (!empty($arrayfields['t.dateo']['checked'])) { From e9ee78ab8fe7dd0fa9fc4e049be4ddb33856c777 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Wed, 25 Mar 2020 11:19:35 +0100 Subject: [PATCH 03/32] NEW hook on product load stats --- htdocs/product/class/product.class.php | 81 +++++++++++++++++++++----- 1 file changed, 66 insertions(+), 15 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 96b2165c65a..adb23d38f75 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2445,8 +2445,7 @@ class Product extends CommonObject public function load_stats_propale($socid = 0) { // phpcs:enable - global $conf; - global $user; + global $conf, $user, $hookmanager; $sql = "SELECT COUNT(DISTINCT p.fk_soc) as nb_customers, COUNT(DISTINCT p.rowid) as nb,"; $sql .= " COUNT(pd.rowid) as nb_rows, SUM(pd.qty) as qty"; @@ -2497,6 +2496,11 @@ class Product extends CommonObject } } + $hookmanager->initHooks(array('productdao')); + $parameters = array('socid' => $socid); + $reshook = $hookmanager->executeHooks('loadStatsPropale', $parameters, $this, $action); + if ($reshook > 0) $this->stats_propale = $hookmanager->resArray['stats_propale']; + return 1; } else @@ -2517,8 +2521,7 @@ class Product extends CommonObject public function load_stats_proposal_supplier($socid = 0) { // phpcs:enable - global $conf; - global $user; + global $conf, $user, $hookmanager; $sql = "SELECT COUNT(DISTINCT p.fk_soc) as nb_suppliers, COUNT(DISTINCT p.rowid) as nb,"; $sql .= " COUNT(pd.rowid) as nb_rows, SUM(pd.qty) as qty"; @@ -2544,6 +2547,12 @@ class Product extends CommonObject $this->stats_proposal_supplier['nb'] = $obj->nb; $this->stats_proposal_supplier['rows'] = $obj->nb_rows; $this->stats_proposal_supplier['qty'] = $obj->qty ? $obj->qty : 0; + + $hookmanager->initHooks(array('productdao')); + $parameters = array('socid' => $socid); + $reshook = $hookmanager->executeHooks('loadStatsProposalSupplier', $parameters, $this, $action); + if ($reshook > 0) $this->stats_proposal_supplier = $hookmanager->resArray['stats_proposal_supplier']; + return 1; } else @@ -2566,7 +2575,7 @@ class Product extends CommonObject public function load_stats_commande($socid = 0, $filtrestatut = '', $forVirtualStock = 0) { // phpcs:enable - global $conf, $user; + global $conf, $user, $hookmanager; $sql = "SELECT COUNT(DISTINCT c.fk_soc) as nb_customers, COUNT(DISTINCT c.rowid) as nb,"; $sql .= " COUNT(cd.rowid) as nb_rows, SUM(cd.qty) as qty"; @@ -2643,7 +2652,10 @@ class Product extends CommonObject $this->stats_commande['qty'] -= $adeduire; } } - + $hookmanager->initHooks(array('productdao')); + $parameters = array('socid' => $socid, 'filtrestatut' => $filtrestatut, 'forVirtualStock' => $forVirtualStock); + $reshook = $hookmanager->executeHooks('loadStatsCommande', $parameters, $this, $action); + if ($reshook > 0) $this->stats_commande = $hookmanager->resArray['stats_commande']; return 1; } else @@ -2665,7 +2677,7 @@ class Product extends CommonObject public function load_stats_commande_fournisseur($socid = 0, $filtrestatut = '', $forVirtualStock = 0) { // phpcs:enable - global $conf, $user; + global $conf, $user, $hookmanager; $sql = "SELECT COUNT(DISTINCT c.fk_soc) as nb_suppliers, COUNT(DISTINCT c.rowid) as nb,"; $sql .= " COUNT(cd.rowid) as nb_rows, SUM(cd.qty) as qty"; @@ -2696,6 +2708,12 @@ class Product extends CommonObject $this->stats_commande_fournisseur['nb'] = $obj->nb; $this->stats_commande_fournisseur['rows'] = $obj->nb_rows; $this->stats_commande_fournisseur['qty'] = $obj->qty ? $obj->qty : 0; + + $hookmanager->initHooks(array('productdao')); + $parameters = array('socid' => $socid, 'filtrestatut' => $filtrestatut, 'forVirtualStock' => $forVirtualStock); + $reshook = $hookmanager->executeHooks('loadStatsCommandeFournisseur', $parameters, $this, $action); + if ($reshook > 0) $this->stats_commande_fournisseur = $hookmanager->resArray['stats_commande_fournisseur']; + return 1; } else @@ -2718,7 +2736,7 @@ class Product extends CommonObject public function load_stats_sending($socid = 0, $filtrestatut = '', $forVirtualStock = 0, $filterShipmentStatus = '') { // phpcs:enable - global $conf, $user; + global $conf, $user, $hookmanager; $sql = "SELECT COUNT(DISTINCT e.fk_soc) as nb_customers, COUNT(DISTINCT e.rowid) as nb,"; $sql .= " COUNT(ed.rowid) as nb_rows, SUM(ed.qty) as qty"; @@ -2775,6 +2793,12 @@ class Product extends CommonObject } } } + + $hookmanager->initHooks(array('productdao')); + $parameters = array('socid' => $socid, 'filtrestatut' => $filtrestatut, 'forVirtualStock' => $forVirtualStock, 'filterShipmentStatus' => $filterShipmentStatus); + $reshook = $hookmanager->executeHooks('loadStatsSending', $parameters, $this, $action); + if ($reshook > 0) $this->stats_expedition = $hookmanager->resArray['stats_expedition']; + return 1; } else @@ -2796,7 +2820,7 @@ class Product extends CommonObject public function load_stats_reception($socid = 0, $filtrestatut = '', $forVirtualStock = 0) { // phpcs:enable - global $conf, $user; + global $conf, $user, $hookmanager; $sql = "SELECT COUNT(DISTINCT cf.fk_soc) as nb_suppliers, COUNT(DISTINCT cf.rowid) as nb,"; $sql .= " COUNT(fd.rowid) as nb_rows, SUM(fd.qty) as qty"; @@ -2823,6 +2847,12 @@ class Product extends CommonObject $this->stats_reception['nb'] = $obj->nb; $this->stats_reception['rows'] = $obj->nb_rows; $this->stats_reception['qty'] = $obj->qty ? $obj->qty : 0; + + $hookmanager->initHooks(array('productdao')); + $parameters = array('socid' => $socid, 'filtrestatut' => $filtrestatut, 'forVirtualStock' => $forVirtualStock); + $reshook = $hookmanager->executeHooks('loadStatsReception', $parameters, $this, $action); + if ($reshook > 0) $this->stats_reception = $hookmanager->resArray['stats_reception']; + return 1; } else @@ -2844,7 +2874,7 @@ class Product extends CommonObject public function load_stats_inproduction($socid = 0, $filtrestatut = '', $forVirtualStock = 0) { // phpcs:enable - global $conf, $user; + global $conf, $user, $hookmanager; $sql = "SELECT COUNT(DISTINCT m.fk_soc) as nb_customers, COUNT(DISTINCT m.rowid) as nb,"; $sql .= " COUNT(mp.rowid) as nb_rows, SUM(mp.qty) as qty, role"; @@ -2910,6 +2940,11 @@ class Product extends CommonObject if ($this->stats_mrptoconsume['qty'] < 0) $this->stats_mrptoconsume['qty'] = 0; if ($this->stats_mrptoproduce['qty'] < 0) $this->stats_mrptoproduce['qty'] = 0; + $hookmanager->initHooks(array('productdao')); + $parameters = array('socid' => $socid, 'filtrestatut' => $filtrestatut, 'forVirtualStock' => $forVirtualStock); + $reshook = $hookmanager->executeHooks('loadStatsInProduction', $parameters, $this, $action); + if ($reshook > 0) $this->stats_mrptoproduce = $hookmanager->resArray['stats_mrptoproduce']; + return 1; } else @@ -2929,8 +2964,7 @@ class Product extends CommonObject public function load_stats_contrat($socid = 0) { // phpcs:enable - global $conf; - global $user; + global $conf, $user, $hookmanager; $sql = "SELECT COUNT(DISTINCT c.fk_soc) as nb_customers, COUNT(DISTINCT c.rowid) as nb,"; $sql .= " COUNT(cd.rowid) as nb_rows, SUM(cd.qty) as qty"; @@ -2980,6 +3014,12 @@ class Product extends CommonObject } } } + + $hookmanager->initHooks(array('productdao')); + $parameters = array('socid' => $socid); + $reshook = $hookmanager->executeHooks('loadStatsContrat', $parameters, $this, $action); + if ($reshook > 0) $this->stats_contrat = $hookmanager->resArray['stats_contrat']; + return 1; } else @@ -2999,7 +3039,7 @@ class Product extends CommonObject public function load_stats_facture($socid = 0) { // phpcs:enable - global $db, $conf, $user; + global $db, $conf, $user, $hookmanager; $sql = "SELECT COUNT(DISTINCT f.fk_soc) as nb_customers, COUNT(DISTINCT f.rowid) as nb,"; $sql .= " COUNT(fd.rowid) as nb_rows, SUM(".$db->ifsql('f.type != 2', 'fd.qty', 'fd.qty * -1').") as qty"; @@ -3049,6 +3089,12 @@ class Product extends CommonObject } } } + + $hookmanager->initHooks(array('productdao')); + $parameters = array('socid' => $socid); + $reshook = $hookmanager->executeHooks('loadStatsFacture', $parameters, $this, $action); + if ($reshook > 0) $this->stats_facture = $hookmanager->resArray['stats_facture']; + return 1; } else @@ -3068,8 +3114,7 @@ class Product extends CommonObject public function load_stats_facture_fournisseur($socid = 0) { // phpcs:enable - global $conf; - global $user; + global $conf, $user, $hookmanager; $sql = "SELECT COUNT(DISTINCT f.fk_soc) as nb_suppliers, COUNT(DISTINCT f.rowid) as nb,"; $sql .= " COUNT(fd.rowid) as nb_rows, SUM(fd.qty) as qty"; @@ -3098,6 +3143,12 @@ class Product extends CommonObject $this->stats_facture_fournisseur['nb'] = $obj->nb; $this->stats_facture_fournisseur['rows'] = $obj->nb_rows; $this->stats_facture_fournisseur['qty'] = $obj->qty ? $obj->qty : 0; + + $hookmanager->initHooks(array('productdao')); + $parameters = array('socid' => $socid); + $reshook = $hookmanager->executeHooks('loadStatsFactureFournisseur', $parameters, $this, $action); + if ($reshook > 0) $this->stats_facture_fournisseur = $hookmanager->resArray['stats_facture_fournisseur']; + return 1; } else From 8662c864d2ba4e489a8203216cbf4b5f7fe9ad61 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 25 Mar 2020 12:14:42 +0100 Subject: [PATCH 04/32] remove not use column from arrayfields --- htdocs/projet/tasks.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 7082e68d97d..9c459d2191d 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -112,8 +112,6 @@ $arrayfields = array( 't.progress_calculated'=>array('label'=>$langs->trans("ProgressCalculated"), 'checked'=>1, 'position'=>8), 't.progress'=>array('label'=>$langs->trans("ProgressDeclared"), 'checked'=>1, 'position'=>9), 't.progress_summary'=>array('label'=>$langs->trans("TaskProgressSummary"), 'checked'=>1, 'position'=>10), - 't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), - 't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), ); if ($object->usage_bill_time) { $arrayfields['t.tobill']=array('label'=>$langs->trans("TimeToBill"), 'checked'=>0, 'position'=>11); From 3e4b788316b6b23632ab23b9726bb1f40f098f12 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Wed, 25 Mar 2020 21:23:55 +0100 Subject: [PATCH 05/32] Update receiptprinter.php with CUPS --- htdocs/admin/receiptprinter.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index 96c00f48312..78b82f42b82 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -1,7 +1,8 @@ - * Copyright (C) 2015 Frederic France - * Copyright (C) 2016 Juanjo Menent +/* Copyright (C) 2013-2016 Laurent Destailleur + * Copyright (C) 2015 Frederic France + * Copyright (C) 2016 Juanjo Menent + * Copyright (C) 2020 Andreu Bisquerra Gaya * * 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 @@ -355,7 +356,7 @@ if ($mode == 'config' && $user->admin) { print ''; print ''; print ''; - //print ''; + print ''; print '
'; + print ''; + print ''; @@ -503,6 +518,13 @@ if (!empty($arrayfields['t.label']['checked'])) print ''; print ''; + print ''; + print '
'; + if (!empty($object->fk_task_parent)) { + $object_parent = new Task($db); + $result = $object_parent->fetch($object->fk_task_parent); + if ($result < 0) { + setEventMessage($object_parent->error, 'errors'); + } else { + print $object_parent->getNomUrl(1, 'withproject'); + if ($object_parent->hasDelay()) + print img_warning("Late"); + } + } + print ''; + print $object->description; + print '
'.$langs->trans("CONNECTOR_NETWORK_PRINT").':'.$langs->trans("CONNECTOR_NETWORK_PRINT_HELP").'
'.$langs->trans("CONNECTOR_FILE_PRINT").':'.$langs->trans("CONNECTOR_FILE_PRINT_HELP").'
'.$langs->trans("CONNECTOR_WINDOWS_PRINT").':'.$langs->trans("CONNECTOR_WINDOWS_PRINT_HELP").'
'.$langs->trans("CONNECTOR_JAVA").':'.$langs->trans("CONNECTOR_JAVA_HELP").'
'.$langs->trans("CONNECTOR_CUPS_PRINT").':'.$langs->trans("CONNECTOR_CUPS_PRINT_HELP").'
'; dol_fiche_end(); From eef3a1795e8faed80710fd1d960d5f827cb72f59 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Wed, 25 Mar 2020 21:30:33 +0100 Subject: [PATCH 06/32] Update dolreceiptprinter.class.php with CUPS --- htdocs/core/class/dolreceiptprinter.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index d241c2a8c5a..468cdf050bc 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -104,6 +104,7 @@ require_once DOL_DOCUMENT_ROOT.'/includes/mike42/escpos-php/autoload.php'; use Mike42\Escpos\PrintConnectors\FilePrintConnector; use Mike42\Escpos\PrintConnectors\NetworkPrintConnector; use Mike42\Escpos\PrintConnectors\WindowsPrintConnector; +use Mike42\Escpos\PrintConnectors\CupsPrintConnector; use Mike42\Escpos\PrintConnectors\DummyPrintConnector; use Mike42\Escpos\CapabilityProfile; use Mike42\Escpos\Printer; @@ -119,7 +120,7 @@ class dolReceiptPrinter extends Printer const CONNECTOR_FILE_PRINT = 2; const CONNECTOR_NETWORK_PRINT = 3; const CONNECTOR_WINDOWS_PRINT = 4; - //const CONNECTOR_JAVA = 5; + const CONNECTOR_CUPS_PRINT = 5; /** * @var DoliDB Database handler. @@ -262,7 +263,7 @@ class dolReceiptPrinter extends Printer $row['fk_type_name'] = 'CONNECTOR_WINDOWS_PRINT'; break; case 5: - $row['fk_type_name'] = 'CONNECTOR_JAVA'; + $row['fk_type_name'] = 'CONNECTOR_CUPS_PRINT'; break; default: $row['fk_type_name'] = 'CONNECTOR_UNKNOWN'; @@ -343,6 +344,7 @@ class dolReceiptPrinter extends Printer 2 => $langs->trans('CONNECTOR_FILE_PRINT'), 3 => $langs->trans('CONNECTOR_NETWORK_PRINT'), 4 => $langs->trans('CONNECTOR_WINDOWS_PRINT'), + 5 => $langs->trans('CONNECTOR_CUPS_PRINT'), ); $this->resprint = Form::selectarray($htmlname, $options, $selected); @@ -839,6 +841,9 @@ class dolReceiptPrinter extends Printer break; case 4: $this->connector = new WindowsPrintConnector($parameter); + break; + case 5: + $this->connector = new CupsPrintConnector($parameter); break; default: $this->connector = 'CONNECTOR_UNKNOWN'; From d420656c3f124b481634188dbf8010bc1c90930f Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Wed, 25 Mar 2020 21:32:58 +0100 Subject: [PATCH 07/32] Update langs --- htdocs/langs/en_US/receiptprinter.lang | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/receiptprinter.lang b/htdocs/langs/en_US/receiptprinter.lang index 3df49b9fe67..b0b60c60840 100644 --- a/htdocs/langs/en_US/receiptprinter.lang +++ b/htdocs/langs/en_US/receiptprinter.lang @@ -15,10 +15,12 @@ CONNECTOR_DUMMY=Dummy Printer CONNECTOR_NETWORK_PRINT=Network Printer CONNECTOR_FILE_PRINT=Local Printer CONNECTOR_WINDOWS_PRINT=Local Windows Printer +CONNECTOR_CUPS_PRINT=Cups Printer CONNECTOR_DUMMY_HELP=Fake Printer for test, does nothing CONNECTOR_NETWORK_PRINT_HELP=10.x.x.x:9100 CONNECTOR_FILE_PRINT_HELP=/dev/usb/lp0, /dev/usb/lp1 CONNECTOR_WINDOWS_PRINT_HELP=LPT1, COM1, smb://FooUser:secret@computername/workgroup/Receipt Printer +CONNECTOR_CUPS_PRINT_HELP=CUPS printer name, example: HPRT_TP805L PROFILE_DEFAULT=Default Profile PROFILE_SIMPLE=Simple Profile PROFILE_EPOSTEP=Epos Tep Profile From 21b98a7c4c6ff502ed5e7438bffca37d9f3e8e21 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 26 Mar 2020 08:24:20 +0100 Subject: [PATCH 08/32] set as global --- htdocs/core/lib/project.lib.php | 5 +---- htdocs/core/tpl/extrafields_list_search_title.tpl.php | 3 ++- htdocs/projet/tasks.php | 1 + htdocs/projet/tasks/list.php | 2 -- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 2092cfc2b12..5a54b45c770 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -360,10 +360,7 @@ function project_admin_prepare_head() function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '', $showbilltime = 0, $arrayfields=array()) { global $user, $langs, $conf, $db, $hookmanager; - global $projectstatic, $taskstatic; - - $extrafields = new ExtraFields($db); - $extrafields->fetch_name_optionals_label($taskstatic->table_element); + global $projectstatic, $taskstatic, $extrafields; $lastprojectid = 0; diff --git a/htdocs/core/tpl/extrafields_list_search_title.tpl.php b/htdocs/core/tpl/extrafields_list_search_title.tpl.php index c6d3776cfe4..9b06fc37eff 100644 --- a/htdocs/core/tpl/extrafields_list_search_title.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_title.tpl.php @@ -8,6 +8,7 @@ if (empty($conf) || ! is_object($conf)) } if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element; +if (!isset($disablesortlink)) $disablesortlink=0; // Loop to show all columns of extrafields for the title line if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... @@ -30,7 +31,7 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_ { $tooltip = empty($extrafields->attributes[$extrafieldsobjectkey]['help'][$key]) ? '' : $extrafields->attributes[$extrafieldsobjectkey]['help'][$key]; - print getTitleFieldOfList($extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'" data-titlekey="'.$key.'"':'data-titlekey="'.$key.'"'), $sortfield, $sortorder, '', 0, $tooltip)."\n"; + print getTitleFieldOfList($extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'" data-titlekey="'.$key.'"':'data-titlekey="'.$key.'"'), $sortfield, $sortorder, '', $disablesortlink, $tooltip)."\n"; } } } diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 9c459d2191d..a95d7162a87 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -796,6 +796,7 @@ elseif ($id > 0 || !empty($ref)) } if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print_liste_field_titre("TaskRessourceLinks", $_SERVER["PHP_SELF"], '', '', $param, $sortfield, $sortorder); // Extra fields + $disablesortlink=1; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index aa4bfad01f1..f55bcb36e9b 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -925,13 +925,11 @@ while ($i < min($num, $limit)) print "\n"; - //print projectLinesa(); } $i++; } // Show total line -//include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['totalplannedworkloadfield']) || isset($totalarray['totalprogress_calculatedfield']) || isset($totalarray['totaltobill']) || isset($totalarray['totalbilled'])) { From 208049a8f2ce3ce0794793b2284cf9a80b517a72 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 26 Mar 2020 07:27:10 +0000 Subject: [PATCH 09/32] Fixing style errors. --- htdocs/core/lib/project.lib.php | 2 +- htdocs/projet/class/task.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 5a54b45c770..0d4ba126df9 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -357,7 +357,7 @@ function project_admin_prepare_head() * @param array $arrayfields Array with displayed coloumn information * @return int Nb of tasks shown */ -function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '', $showbilltime = 0, $arrayfields=array()) +function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '', $showbilltime = 0, $arrayfields = array()) { global $user, $langs, $conf, $db, $hookmanager; global $projectstatic, $taskstatic, $extrafields; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 2e13a551e97..f3457b2481f 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -746,7 +746,7 @@ class Task extends CommonObject * @param array $search_array_options Array of search * @return array Array of tasks */ - public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options=array()) + public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array()) { global $conf, $hookmanager; From f7762f11db84c2b3b8a600fc92e8640458d3959d Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Thu, 26 Mar 2020 09:13:56 +0100 Subject: [PATCH 10/32] Fix change multicurrency line in supplier proposal --- .../class/supplier_proposal.class.php | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index d1d3b08bc2d..695b7d63e4a 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -14,6 +14,7 @@ * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019 Frédéric France + * Copyright (C) 2020 Tobias Sekan * * 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 @@ -595,12 +596,12 @@ class SupplierProposal extends CommonObject //var_dump($this->line->fk_fournprice);exit; // Multicurrency - $this->line->fk_multicurrency = $this->fk_multicurrency; - $this->line->multicurrency_code = $this->multicurrency_code; + $this->line->fk_multicurrency = $this->fk_multicurrency; + $this->line->multicurrency_code = $this->multicurrency_code; $this->line->multicurrency_subprice = $pu_ht_devise; - $this->line->multicurrency_total_ht = $multicurrency_total_ht; - $this->line->multicurrency_total_tva = $multicurrency_total_tva; - $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; + $this->line->multicurrency_total_ht = $multicurrency_total_ht; + $this->line->multicurrency_total_tva = $multicurrency_total_tva; + $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; // Mise en option de la ligne if (empty($qty) && empty($special_code)) $this->line->special_code = 3; @@ -708,6 +709,10 @@ class SupplierProposal extends CommonObject $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. } + if ($conf->multicurrency->enabled && $pu_ht_devise > 0) { + $pu = 0; + } + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -719,6 +724,7 @@ class SupplierProposal extends CommonObject $multicurrency_total_ht = $tabprice[16]; $multicurrency_total_tva = $tabprice[17]; $multicurrency_total_ttc = $tabprice[18]; + $pu_ht_devise = $tabprice[19]; //Fetch current line from the database and then clone the object and set it in $oldline property $line = new SupplierProposalLine($this->db); @@ -784,11 +790,11 @@ class SupplierProposal extends CommonObject } } - // Multicurrency - $this->line->multicurrency_subprice = price2num($pu * $this->multicurrency_tx); - $this->line->multicurrency_total_ht = $multicurrency_total_ht; - $this->line->multicurrency_total_tva = $multicurrency_total_tva; - $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; + // Multicurrency + $this->line->multicurrency_subprice = $pu_ht_devise; + $this->line->multicurrency_total_ht = $multicurrency_total_ht; + $this->line->multicurrency_total_tva = $multicurrency_total_tva; + $this->line->multicurrency_total_ttc = $multicurrency_total_ttc; $result = $this->line->update(); if ($result > 0) From cef65a3c8f404e980a71ac417e7d4d2c02e16e82 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Thu, 26 Mar 2020 09:20:14 +0100 Subject: [PATCH 11/32] FIX hook name and useless inithook --- htdocs/product/class/product.class.php | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index adb23d38f75..a4f60d48dcd 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2496,9 +2496,8 @@ class Product extends CommonObject } } - $hookmanager->initHooks(array('productdao')); $parameters = array('socid' => $socid); - $reshook = $hookmanager->executeHooks('loadStatsPropale', $parameters, $this, $action); + $reshook = $hookmanager->executeHooks('loadStatsCustomerProposal', $parameters, $this, $action); if ($reshook > 0) $this->stats_propale = $hookmanager->resArray['stats_propale']; return 1; @@ -2548,9 +2547,8 @@ class Product extends CommonObject $this->stats_proposal_supplier['rows'] = $obj->nb_rows; $this->stats_proposal_supplier['qty'] = $obj->qty ? $obj->qty : 0; - $hookmanager->initHooks(array('productdao')); $parameters = array('socid' => $socid); - $reshook = $hookmanager->executeHooks('loadStatsProposalSupplier', $parameters, $this, $action); + $reshook = $hookmanager->executeHooks('loadStatsSupplierProposal', $parameters, $this, $action); if ($reshook > 0) $this->stats_proposal_supplier = $hookmanager->resArray['stats_proposal_supplier']; return 1; @@ -2652,9 +2650,9 @@ class Product extends CommonObject $this->stats_commande['qty'] -= $adeduire; } } - $hookmanager->initHooks(array('productdao')); + $parameters = array('socid' => $socid, 'filtrestatut' => $filtrestatut, 'forVirtualStock' => $forVirtualStock); - $reshook = $hookmanager->executeHooks('loadStatsCommande', $parameters, $this, $action); + $reshook = $hookmanager->executeHooks('loadStatsCustomerOrder', $parameters, $this, $action); if ($reshook > 0) $this->stats_commande = $hookmanager->resArray['stats_commande']; return 1; } @@ -2709,9 +2707,8 @@ class Product extends CommonObject $this->stats_commande_fournisseur['rows'] = $obj->nb_rows; $this->stats_commande_fournisseur['qty'] = $obj->qty ? $obj->qty : 0; - $hookmanager->initHooks(array('productdao')); $parameters = array('socid' => $socid, 'filtrestatut' => $filtrestatut, 'forVirtualStock' => $forVirtualStock); - $reshook = $hookmanager->executeHooks('loadStatsCommandeFournisseur', $parameters, $this, $action); + $reshook = $hookmanager->executeHooks('loadStatsSupplierOrder', $parameters, $this, $action); if ($reshook > 0) $this->stats_commande_fournisseur = $hookmanager->resArray['stats_commande_fournisseur']; return 1; @@ -2794,7 +2791,6 @@ class Product extends CommonObject } } - $hookmanager->initHooks(array('productdao')); $parameters = array('socid' => $socid, 'filtrestatut' => $filtrestatut, 'forVirtualStock' => $forVirtualStock, 'filterShipmentStatus' => $filterShipmentStatus); $reshook = $hookmanager->executeHooks('loadStatsSending', $parameters, $this, $action); if ($reshook > 0) $this->stats_expedition = $hookmanager->resArray['stats_expedition']; @@ -2848,7 +2844,6 @@ class Product extends CommonObject $this->stats_reception['rows'] = $obj->nb_rows; $this->stats_reception['qty'] = $obj->qty ? $obj->qty : 0; - $hookmanager->initHooks(array('productdao')); $parameters = array('socid' => $socid, 'filtrestatut' => $filtrestatut, 'forVirtualStock' => $forVirtualStock); $reshook = $hookmanager->executeHooks('loadStatsReception', $parameters, $this, $action); if ($reshook > 0) $this->stats_reception = $hookmanager->resArray['stats_reception']; @@ -2940,7 +2935,6 @@ class Product extends CommonObject if ($this->stats_mrptoconsume['qty'] < 0) $this->stats_mrptoconsume['qty'] = 0; if ($this->stats_mrptoproduce['qty'] < 0) $this->stats_mrptoproduce['qty'] = 0; - $hookmanager->initHooks(array('productdao')); $parameters = array('socid' => $socid, 'filtrestatut' => $filtrestatut, 'forVirtualStock' => $forVirtualStock); $reshook = $hookmanager->executeHooks('loadStatsInProduction', $parameters, $this, $action); if ($reshook > 0) $this->stats_mrptoproduce = $hookmanager->resArray['stats_mrptoproduce']; @@ -3015,9 +3009,8 @@ class Product extends CommonObject } } - $hookmanager->initHooks(array('productdao')); $parameters = array('socid' => $socid); - $reshook = $hookmanager->executeHooks('loadStatsContrat', $parameters, $this, $action); + $reshook = $hookmanager->executeHooks('loadStatsContract', $parameters, $this, $action); if ($reshook > 0) $this->stats_contrat = $hookmanager->resArray['stats_contrat']; return 1; @@ -3090,9 +3083,8 @@ class Product extends CommonObject } } - $hookmanager->initHooks(array('productdao')); $parameters = array('socid' => $socid); - $reshook = $hookmanager->executeHooks('loadStatsFacture', $parameters, $this, $action); + $reshook = $hookmanager->executeHooks('loadStatsCustomerInvoice', $parameters, $this, $action); if ($reshook > 0) $this->stats_facture = $hookmanager->resArray['stats_facture']; return 1; @@ -3144,9 +3136,8 @@ class Product extends CommonObject $this->stats_facture_fournisseur['rows'] = $obj->nb_rows; $this->stats_facture_fournisseur['qty'] = $obj->qty ? $obj->qty : 0; - $hookmanager->initHooks(array('productdao')); $parameters = array('socid' => $socid); - $reshook = $hookmanager->executeHooks('loadStatsFactureFournisseur', $parameters, $this, $action); + $reshook = $hookmanager->executeHooks('loadStatsSupplierInvoice', $parameters, $this, $action); if ($reshook > 0) $this->stats_facture_fournisseur = $hookmanager->resArray['stats_facture_fournisseur']; return 1; From 4624fd244512a26e16d0c15a0014f34bc2c9e679 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Thu, 26 Mar 2020 09:23:19 +0100 Subject: [PATCH 12/32] Fix add mulitcurrency line in supplier proposal --- htdocs/supplier_proposal/card.php | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 2c23f578fb4..1956099b406 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -11,6 +11,7 @@ * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Ferran Marcet * Copyright (C) 2018 Frédéric France + * Copyright (C) 2020 Tobias Sekan * * 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 @@ -715,7 +716,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'errors'); } } - elseif ((GETPOST('price_ht') !== '' || GETPOST('price_ttc') !== '') && empty($error)) // Free product. // $price_ht is already set + elseif ((GETPOST('price_ht') !== '' || GETPOST('price_ttc') !== '' || GETPOST('multicurrency_price_ht') != '') && empty($error)) // Free product. // $price_ht is already set { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); @@ -745,8 +746,31 @@ if (empty($reshook)) $price_base_type = 'HT'; $pu_ht_devise = price2num($price_ht_devise, 'MU'); - $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $ref_supplier, $fk_unit); - //$result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end, $array_options, $fk_unit); + $result = $object->addline( + $desc, + $pu_ht, + $qty, + $tva_tx, + $localtax1_tx, + $localtax2_tx, + $idprod, + $remise_percent, + $price_base_type, + $pu_ttc, + $info_bits, + $type, + -1, // rang + 0, // special_code + GETPOST('fk_parent_line'), + $fournprice, + $buyingprice, + $label, + $array_options, + $ref_supplier, + $fk_unit, + '', // origin + 0, // origin_id + $pu_ht_devise); } From 1e13dbe2708e4f266558d72f93df24ae4f6fb411 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Thu, 26 Mar 2020 09:29:35 +0100 Subject: [PATCH 13/32] fix non numeric error --- htdocs/supplier_proposal/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 1956099b406..18913db2f7c 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -863,10 +863,10 @@ if (empty($reshook)) if (GETPOST('price_ht') != '') { - $price_base_type = 'HT'; $ht = price2num(GETPOST('price_ht')); } - else + + if (GETPOST('price_ttc') != '') { $reg = array(); $vatratecleaned = $vat_rate; @@ -878,9 +878,9 @@ if (empty($reshook)) $ttc = price2num(GETPOST('price_ttc')); $ht = $ttc / (1 + ($vatratecleaned / 100)); - $price_base_type = 'HT'; } + $price_base_type = 'HT'; $pu_ht_devise = GETPOST('multicurrency_subprice'); // Add buying price From 38029abcb14a9cd09023bb6bf199d78d9affd2b1 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 26 Mar 2020 08:34:27 +0000 Subject: [PATCH 14/32] Fixing style errors. --- htdocs/supplier_proposal/class/supplier_proposal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 695b7d63e4a..ab451b02177 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -712,7 +712,7 @@ class SupplierProposal extends CommonObject if ($conf->multicurrency->enabled && $pu_ht_devise > 0) { $pu = 0; } - + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; From e1611a836619e84311c8be216b059026d3bb5996 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 27 Mar 2020 06:16:24 +0100 Subject: [PATCH 15/32] Typo --- htdocs/compta/recap-compta.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index 37bf3d36d70..3f2112537b1 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -83,7 +83,7 @@ $form = new Form($db); $userstatic = new User($db); $title = $langs->trans("ThirdParty").' - '.$langs->trans("Summary"); -if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->name.' - '.$langs->trans("Symmary"); +if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->name.' - '.$langs->trans("Summary"); $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('', $title, $help_url); From 497b0e4ecc5c28a58931c05987c66da0900d07d4 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 27 Mar 2020 15:30:05 +0100 Subject: [PATCH 16/32] NEW filter by product on supplier order let's get the next replenishment date and order's informations on front-end for selected products --- htdocs/fourn/class/api_supplier_orders.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index cb2e27b1a97..c569e84c795 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -90,13 +90,14 @@ class SupplierOrders extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} + * @param string $product_ids Product ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $status Filter by order status : draft | validated | approved | running | received_start | received_end | cancelled | refused * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" * @return array Array of order objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $product_ids = '', $status = '', $sqlfilters = '') { global $db, $conf; @@ -115,8 +116,11 @@ class SupplierOrders extends DolibarrApi if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale + if (!empty($product_ids)) $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseurdet as cd"; // We need this table joined to the select in order to filter by product + $sql.= ' WHERE t.entity IN ('.getEntity('supplier_order').')'; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; + if (!empty($product_ids)) $sql.= " AND cd.fk_commande = t.rowid AND cd.fk_product IN (".$product_ids.")"; if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")"; if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale From 815ae3cb0969eddd3ba56720a275450d7d0ce282 Mon Sep 17 00:00:00 2001 From: Matt Sidnell <54064522+pstructures@users.noreply.github.com> Date: Fri, 27 Mar 2020 21:51:34 +0000 Subject: [PATCH 17/32] Ability to add new tabs on company admin section I have added the option to add a tab from a module to the main company setup section. I need this ability so thought that others might too. --- htdocs/core/lib/admin.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 7d3658d4f97..dd7313f1d0b 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1781,7 +1781,8 @@ function company_admin_prepare_head() $h++; complete_head_from_modules($conf, $langs, null, $head, $h, 'company_admin', 'remove'); - + complete_head_from_modules($conf, $langs, null, $head, $h, 'company_admin', 'add'); + return $head; } From 0db7c2bf215b68cde64f3b552f793fbfbc47115f Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Fri, 27 Mar 2020 23:19:56 +0100 Subject: [PATCH 18/32] TakePOS CSS fix in action buttons --- htdocs/takepos/css/pos.css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index 7d4fd9be051..5f0006d24fe 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -153,7 +153,7 @@ button.actionbutton { vertical-align: middle; text-align: center; overflow: visible; /* removes extra width in IE */ - width:33%; + width: calc(33% - 2px); height: calc(25% - 2px); margin: 1px; border-width: 0; From f93bdf6b22efebbdac98b78663e7c43804d56b61 Mon Sep 17 00:00:00 2001 From: Matt Sidnell <54064522+pstructures@users.noreply.github.com> Date: Fri, 27 Mar 2020 23:09:40 +0000 Subject: [PATCH 19/32] Fix so company_admin tabs do not show in Societe fix --- htdocs/core/lib/company.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index eac9f404188..1047081d0d4 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -402,7 +402,7 @@ function societe_admin_prepare_head() // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab - complete_head_from_modules($conf, $langs, null, $head, $h, 'company_admin'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'societe_admin'); $head[$h][0] = DOL_URL_ROOT.'/societe/admin/societe_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsThirdParties"); @@ -414,7 +414,7 @@ function societe_admin_prepare_head() $head[$h][2] = 'attributes_contacts'; $h++; - complete_head_from_modules($conf, $langs, null, $head, $h, 'company_admin', 'remove'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'societe_admin', 'remove'); return $head; } From 6f07b87cdeffc6bd93f47f094270ceb2def847d0 Mon Sep 17 00:00:00 2001 From: Matt Sidnell <54064522+pstructures@users.noreply.github.com> Date: Fri, 27 Mar 2020 23:22:02 +0000 Subject: [PATCH 20/32] Update admin.lib.php --- htdocs/core/lib/admin.lib.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index dd7313f1d0b..27a846ab5fa 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1782,7 +1782,6 @@ function company_admin_prepare_head() complete_head_from_modules($conf, $langs, null, $head, $h, 'company_admin', 'remove'); complete_head_from_modules($conf, $langs, null, $head, $h, 'company_admin', 'add'); - return $head; } From b0e7bd8a30e1c8f150bacf34f9e08e199348289d Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 30 Mar 2020 10:20:56 +0200 Subject: [PATCH 21/32] Finish BOM cost calculation --- htdocs/bom/bom_card.php | 7 ++----- htdocs/bom/class/bom.class.php | 34 +++++++++++++++++++++++++++++++--- htdocs/langs/en_US/mrp.lang | 4 +++- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 4a919d7bb2a..887a319aefe 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -68,7 +68,6 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view'; // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. -$object->calculateCosts(); // Security check - Protection if external user //if ($user->socid > 0) accessforbidden(); @@ -524,7 +523,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $keyforbreak = 'duration'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - print 'Coût total'.price($object->total_cost).''; + print ''.$langs->trans("TotalCost").''.price($object->total_cost).''; + print ''.$langs->trans("UnitCost").''.price($object->unit_cost).''; // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; @@ -545,9 +545,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (!empty($object->table_element_line)) { - // Show object lines - $result = $object->getLinesArray(); - print ' diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 5e25ef7fb14..ea47b39dad2 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -166,6 +166,16 @@ class BOM extends CommonObject */ public $lines = array(); + /** + * @var int Calculated cost for the BOM + */ + public $total_cost = 0; + + /** + * @var int Calculated cost for 1 unit of the product in BOM + */ + public $unit_cost = 0; + /** @@ -324,6 +334,7 @@ class BOM extends CommonObject { $result = $this->fetchCommon($id, $ref); if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines(); + $this->calculateCosts(); return $result; } @@ -912,7 +923,6 @@ class BOM extends CommonObject else { $this->lines = $result; - $this->calculateCosts(); return $this->lines; } } @@ -993,17 +1003,25 @@ class BOM extends CommonObject return $error; } + /** + * BOM costs calculation based on cost_price or pmp of each BOM line + */ public function calculateCosts() { include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + $this->unit_cost = 0; $this->total_cost = 0; + foreach ($this->lines as &$line) { $tmpproduct = new Product($this->db); $tmpproduct->fetch($line->fk_product); - $line->unit_cost = $tmpproduct->cost_price; // TODO : add option to work with cost_price or pmp - $line->total_cost = price2num($line->qty * $line->unit_cost); + $line->unit_cost = (!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp; // TODO : add option to work with cost_price or pmp + $line->total_cost = price2num($line->qty * $line->unit_cost, 'MT'); $this->total_cost += $line->total_cost; } + + $this->total_cost = price2num($this->total_cost, 'MT'); + $this->unit_cost = price2num($this->total_cost / $this->qty, 'MU'); } } @@ -1086,6 +1104,16 @@ class BOMLine extends CommonObjectLine public $import_key; // END MODULEBUILDER PROPERTIES + /** + * @var int Calculated cost for the BOM line + */ + public $total_cost = 0; + + /** + * @var int Line unit cost based on product cost price or pmp + */ + public $unit_cost = 0; + /** * Constructor diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 41be1d993b8..4e653e04409 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -70,4 +70,6 @@ ProductQtyToConsumeByMO=Product quantity still to consume by open MO ProductQtyToProduceByMO=Product quentity still to produce by open MO AddNewConsumeLines=Add new line to consume ProductsToConsume=Products to consume -ProductsToProduce=Products to produce \ No newline at end of file +ProductsToProduce=Products to produce +UnitCost=Unit cost +TotalCost=Total cost From 3a349e653340e3d7a2bc4c4491891b48573828a1 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 30 Mar 2020 08:25:57 +0000 Subject: [PATCH 22/32] Fixing style errors. --- htdocs/bom/class/bom.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index ea47b39dad2..e65a56a1e72 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1006,7 +1006,8 @@ class BOM extends CommonObject /** * BOM costs calculation based on cost_price or pmp of each BOM line */ - public function calculateCosts() { + public function calculateCosts() + { include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; $this->unit_cost = 0; $this->total_cost = 0; From 8e4e1002f939a541cf9152da47b0f879f8e89687 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 30 Mar 2020 10:33:48 +0200 Subject: [PATCH 23/32] Missing return comment --- htdocs/bom/class/bom.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index ea47b39dad2..54411f2da0f 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1005,6 +1005,7 @@ class BOM extends CommonObject /** * BOM costs calculation based on cost_price or pmp of each BOM line + * @return void */ public function calculateCosts() { include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; From 13dcf9662c3f6f0b5af47fc2a5d322eda1b0fbce Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Mon, 30 Mar 2020 11:13:10 +0200 Subject: [PATCH 24/32] Add phpmatrix.md --- doc/phpmatrix.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 doc/phpmatrix.md diff --git a/doc/phpmatrix.md b/doc/phpmatrix.md new file mode 100644 index 00000000000..ce336856ed0 --- /dev/null +++ b/doc/phpmatrix.md @@ -0,0 +1,36 @@ +# Dolibarr PHP support + +## Dolibar current + +| Dolibarr | Latest | Minimum PHP | Maximum PHP | +| -------- | ---------- | ----------- | ----------- | +| 12 | develop | PHP 5.6+ | PHP 7.4 | +| 11 | 11.0.3 | PHP 5.5+ | PHP 7.3 | +| 10 | 10.0.6 | PHP 5.5+ | PHP 7.3 | +| 9 | 9.0.4 | PHP 5.4+ | PHP 7.3 | +| 8 | 8.0.6 | PHP 5.3+ | PHP 7.2 | +| 7 | 7.0.5 | PHP 5.3+ | PHP 7.2 | +| 6 | 6.0.8 | PHP 5.3+ | PHP 7.1 | +| 5 | 5.0.7 | PHP 5.3+ | PHP 7.0 | +| 4 | 4.0.6 | PHP 5.0+ | PHP 5.x | + +## Dolibar 3.x + +| Dolibarr | Latest | Minimum PHP | Maximum PHP | +| -------- | ---------- | ----------- | ----------- | +| 3.9 | 3.9.4 | PHP 5.0+ | PHP 5.x | +| 3.8 | 3.8.5 | PHP 5.0+ | PHP 5.x | +| 3.7 | 3.7.4 | PHP 5.0+ | PHP 5.x | +| 3.6 | 3.6.7 | PHP 5.0+ | PHP 5.x | +| 3.5 | 3.5.8 | PHP 5.0+ | PHP 5.x | +| 3.4 | 3.4.3 | PHP 5.0+ | PHP 5.x | +| 3.3 | 3.3.5 | PHP 5.0+ | PHP 5.x | +| 3.2 | 3.2.3 | PHP 5.0+ | PHP 5.x | +| 3.1 | 3.1.3 | PHP 4+ | PHP 5.x | +| 3.0 | 3.0 | PHP 4+ | PHP 5.x | + +## Dolibar 2.x + +* Minimum PHP: PHP 4 +* Maximum PHP: PHP 5 (since 2.1) + From 4dbf7b6f5816b19e3d76d4763fa8648ab431da50 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Mon, 30 Mar 2020 09:20:24 +0000 Subject: [PATCH 25/32] Update readme.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index b8d067ffb7a..11e69c5e593 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,8 @@ Releases can be downloaded from [official website](https://www.dolibarr.org/). You can use a Web server and a supported database (MariaDB, MySQL or PostgreSQL) to install the standard version. +- Check that your installed PHP version is supported [see PHP support](./doc/phpmatrix.md). + - Uncompress the downloaded .zip archive to copy the "dolibarr/htdocs" directory and all its files inside your web server root or get the files directly from GitHub (recommanded if you known git): `git clone https://github.com/dolibarr/dolibarr -b x.y` (where x.y is main version like 3.6, 9.0, ...) @@ -68,6 +70,7 @@ If you don't have time to install it yourself, you can try some commercial 'read ## UPGRADING - At first make a backup of your Dolibarr files & than see https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr +- Check that your installed PHP version is support by the new version [see PHP support](./doc/phpmatrix.md). - Overwrite all old files from 'dolibarr' directory with files provided into the new version's package. - At first next access, Dolibarr will redirect your to the "install/" page to follow the upgrade process.  If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file into the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*"). From e27500ce641dc745e374d114adb7f3a4d0d4ea7d Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Mon, 30 Mar 2020 12:24:21 +0200 Subject: [PATCH 26/32] Fix function to create a task --- htdocs/projet/class/task.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 3b91c867ebe..bba05a55c8e 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -158,7 +158,6 @@ class Task extends CommonObject $sql .= "entity"; $sql .= ", fk_projet"; $sql .= ", ref"; - $sql .= ", entity"; $sql .= ", fk_task_parent"; $sql .= ", label"; $sql .= ", description"; @@ -172,7 +171,6 @@ class Task extends CommonObject $sql .= $conf->entity; $sql .= ", ".$this->fk_project; $sql .= ", ".(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'null'); - $sql .= ", ".$conf->entity; $sql .= ", ".$this->fk_task_parent; $sql .= ", '".$this->db->escape($this->label)."'"; $sql .= ", '".$this->db->escape($this->description)."'"; From d760b6618dd2bf1b64452b5ff0c68d8a9f1b0d32 Mon Sep 17 00:00:00 2001 From: oscim Date: Mon, 30 Mar 2020 18:27:18 +0200 Subject: [PATCH 27/32] Fix use correctly hosts in connection cf https://github.com/Dolibarr/dolibarr/issues/9426 --- htdocs/core/class/smtps.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 39c7d3ba778..2031d23eece 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -490,9 +490,9 @@ class SMTPs } // Most server servers expect a 2nd pass of EHLO after TLS is established to get another time // the answer with list of supported AUTH methods. They may differs between non STARTTLS and with STARTTLS. - if (!$_retVal = $this->socket_send_str('EHLO '.$host, '250')) + if (!$_retVal = $this->socket_send_str('EHLO '.$hosth, '250')) { - $this->_setErr(126, '"'.$host.'" does not support authenticated connections.'); + $this->_setErr(126, '"'.$hosth.'" does not support authenticated connections.'); return $_retVal; } } From 95de8d1992c203d532cd35e4e88e18d4fd9368e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Mar 2020 19:23:25 +0200 Subject: [PATCH 28/32] Update admin.lib.php --- htdocs/core/lib/admin.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 27a846ab5fa..a31159c22d2 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1780,8 +1780,10 @@ function company_admin_prepare_head() $head[$h][2] = 'accountant'; $h++; - complete_head_from_modules($conf, $langs, null, $head, $h, 'company_admin', 'remove'); - complete_head_from_modules($conf, $langs, null, $head, $h, 'company_admin', 'add'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'mycompany_admin', 'add'); + + complete_head_from_modules($conf, $langs, null, $head, $h, 'mycompany_admin', 'remove'); + return $head; } From 06277ec6e040984f491946b04a9f1a8695af934c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Mar 2020 19:24:00 +0200 Subject: [PATCH 29/32] Update company.lib.php --- htdocs/core/lib/company.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 1047081d0d4..eac9f404188 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -402,7 +402,7 @@ function societe_admin_prepare_head() // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab - complete_head_from_modules($conf, $langs, null, $head, $h, 'societe_admin'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'company_admin'); $head[$h][0] = DOL_URL_ROOT.'/societe/admin/societe_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsThirdParties"); @@ -414,7 +414,7 @@ function societe_admin_prepare_head() $head[$h][2] = 'attributes_contacts'; $h++; - complete_head_from_modules($conf, $langs, null, $head, $h, 'societe_admin', 'remove'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'company_admin', 'remove'); return $head; } From 0e1e825802cc8c1429573ef747dae7ea42bf95e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Mar 2020 19:32:02 +0200 Subject: [PATCH 30/32] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 11e69c5e593..6f813fa1626 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ If you don't have time to install it yourself, you can try some commercial 'read ## UPGRADING - At first make a backup of your Dolibarr files & than see https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr -- Check that your installed PHP version is support by the new version [see PHP support](./doc/phpmatrix.md). +- Check that your installed PHP version is supported by the new version [see PHP support](./doc/phpmatrix.md). - Overwrite all old files from 'dolibarr' directory with files provided into the new version's package. - At first next access, Dolibarr will redirect your to the "install/" page to follow the upgrade process.  If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file into the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*"). From 2a57b0acc6150fc3a5543a0552fb6dc99c02322c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Mar 2020 19:34:29 +0200 Subject: [PATCH 31/32] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6f813fa1626..fbf59a27a74 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Releases can be downloaded from [official website](https://www.dolibarr.org/). You can use a Web server and a supported database (MariaDB, MySQL or PostgreSQL) to install the standard version. -- Check that your installed PHP version is supported [see PHP support](./doc/phpmatrix.md). +- Check that your installed PHP version is supported [see PHP support](https://wiki.dolibarr.org/index.php/Versions). - Uncompress the downloaded .zip archive to copy the "dolibarr/htdocs" directory and all its files inside your web server root or get the files directly from GitHub (recommanded if you known git): From 920eedb542136c548fe574673c73c8c98cabb662 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Mar 2020 19:34:40 +0200 Subject: [PATCH 32/32] Delete phpmatrix.md --- doc/phpmatrix.md | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 doc/phpmatrix.md diff --git a/doc/phpmatrix.md b/doc/phpmatrix.md deleted file mode 100644 index ce336856ed0..00000000000 --- a/doc/phpmatrix.md +++ /dev/null @@ -1,36 +0,0 @@ -# Dolibarr PHP support - -## Dolibar current - -| Dolibarr | Latest | Minimum PHP | Maximum PHP | -| -------- | ---------- | ----------- | ----------- | -| 12 | develop | PHP 5.6+ | PHP 7.4 | -| 11 | 11.0.3 | PHP 5.5+ | PHP 7.3 | -| 10 | 10.0.6 | PHP 5.5+ | PHP 7.3 | -| 9 | 9.0.4 | PHP 5.4+ | PHP 7.3 | -| 8 | 8.0.6 | PHP 5.3+ | PHP 7.2 | -| 7 | 7.0.5 | PHP 5.3+ | PHP 7.2 | -| 6 | 6.0.8 | PHP 5.3+ | PHP 7.1 | -| 5 | 5.0.7 | PHP 5.3+ | PHP 7.0 | -| 4 | 4.0.6 | PHP 5.0+ | PHP 5.x | - -## Dolibar 3.x - -| Dolibarr | Latest | Minimum PHP | Maximum PHP | -| -------- | ---------- | ----------- | ----------- | -| 3.9 | 3.9.4 | PHP 5.0+ | PHP 5.x | -| 3.8 | 3.8.5 | PHP 5.0+ | PHP 5.x | -| 3.7 | 3.7.4 | PHP 5.0+ | PHP 5.x | -| 3.6 | 3.6.7 | PHP 5.0+ | PHP 5.x | -| 3.5 | 3.5.8 | PHP 5.0+ | PHP 5.x | -| 3.4 | 3.4.3 | PHP 5.0+ | PHP 5.x | -| 3.3 | 3.3.5 | PHP 5.0+ | PHP 5.x | -| 3.2 | 3.2.3 | PHP 5.0+ | PHP 5.x | -| 3.1 | 3.1.3 | PHP 4+ | PHP 5.x | -| 3.0 | 3.0 | PHP 4+ | PHP 5.x | - -## Dolibar 2.x - -* Minimum PHP: PHP 4 -* Maximum PHP: PHP 5 (since 2.1) -