Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2020-03-30 19:43:03 +02:00
commit 0b7b97ec34
24 changed files with 575 additions and 303 deletions

View File

@ -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](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):
`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 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*").

View File

@ -1,7 +1,8 @@
<?php
/* Copyright (C) 2013-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
/* Copyright (C) 2013-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Andreu Bisquerra Gaya <jove@bisquerra.com>
*
* 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 '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT").':</td><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_FILE_PRINT").':</td><td>'.$langs->trans("CONNECTOR_FILE_PRINT_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT_HELP").'</td></tr>';
//print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_JAVA").':</td><td>'.$langs->trans("CONNECTOR_JAVA_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_CUPS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_CUPS_PRINT_HELP").'</td></tr>';
print '</table>';
dol_fiche_end();

View File

@ -523,6 +523,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$keyforbreak = 'duration';
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
print '<tr><td>'.$langs->trans("TotalCost").'</td><td>'.price($object->total_cost).'</td></tr>';
print '<tr><td>'.$langs->trans("UnitCost").'</td><td>'.price($object->unit_cost).'</td></tr>';
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
@ -542,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 ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#addline' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
<input type="hidden" name="token" value="' . newToken().'">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">

View File

@ -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;
}
@ -991,6 +1002,29 @@ class BOM extends CommonObject
return $error;
}
/**
* 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';
$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 = (!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');
}
}
@ -1072,6 +1106,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

View File

@ -133,6 +133,11 @@ print '<td class="bordertop nobottom nowrap linecollost right">';
print '<input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="'.(GETPOSTISSET("efficiency")?GETPOST("efficiency", 'alpha'):1).'">';
print '</td>';
$coldisplay++;
print '<td class="bordertop nobottom nowrap linecolcost right">';
print '&nbsp;';
print '</td>';
$coldisplay += $colspan;
print '<td class="bordertop nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';
print '<input type="submit" class="button" value="'.$langs->trans('Add').'" name="addline" id="addline">';

View File

@ -60,13 +60,16 @@ if ($conf->global->PRODUCT_USE_UNITS)
}
// Qty frozen
print '<td class="linecolqty right">'.$form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")).'</td>';
print '<td class="linecolqtyfrozen right">'.$form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")).'</td>';
// Disable stock change
print '<td class="linecolqty right">'.$form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')).'</td>';
print '<td class="linecoldisablestockchange right">'.$form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')).'</td>';
// Efficiency
print '<td class="linecollost right">'.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).'</td>';
print '<td class="linecolefficiency right">'.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).'</td>';
// Cost
print '<td class="linecolcost right">'.$langs->trans('CostPrice').'</td>';
print '<td class="linecoledit"></td>'; // No width to allow autodim

View File

@ -103,6 +103,11 @@ $coldisplay++;
echo $line->efficiency;
print '</td>';
print '<td class="linecolcost nowrap right">';
$coldisplay++;
echo price($line->total_cost);
print '</td>';
if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines' ) {
print '<td class="linecoledit center">';
$coldisplay++;

View File

@ -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);

View File

@ -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';

View File

@ -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;
}
}

View File

@ -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, 'mycompany_admin', 'add');
complete_head_from_modules($conf, $langs, null, $head, $h, 'mycompany_admin', 'remove');
return $head;
}

View File

@ -354,12 +354,13 @@ 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 $projectstatic, $taskstatic;
global $user, $langs, $conf, $db, $hookmanager;
global $projectstatic, $taskstatic, $extrafields;
$lastprojectid = 0;
@ -375,7 +376,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 +487,56 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
}
// Ref of task
print '<td class="nowraponall">';
if ($showlineingray)
{
print '<i>'.img_object('', 'projecttask').' '.$lines[$i]->ref.'</i>';
if (count($arrayfields)>0 && !empty($arrayfields['t.ref']['checked'])) {
print '<td class="nowraponall">';
if ($showlineingray) {
print '<i>' . img_object('', 'projecttask') . ' ' . $lines[$i]->ref . '</i>';
} else {
print $taskstatic->getNomUrl(1, 'withproject');
}
print '</td>';
}
else
{
print $taskstatic->getNomUrl(1, 'withproject');
}
print '</td>';
// Title of task
print "<td>";
if ($showlineingray) print '<i>';
//else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/task.php?id='.$lines[$i]->id.'&withproject=1">';
for ($k = 0; $k < $level; $k++)
{
print '<div class="marginleftonly">';
if (count($arrayfields)>0 && !empty($arrayfields['t.label']['checked'])) {
print "<td>";
if ($showlineingray)
print '<i>';
//else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/task.php?id='.$lines[$i]->id.'&withproject=1">';
for ($k = 0; $k < $level; $k++) {
print '<div class="marginleftonly">';
}
print $lines[$i]->label;
for ($k = 0; $k < $level; $k++) {
print '</div>';
}
if ($showlineingray)
print '</i>';
//else print '</a>';
print "</td>\n";
}
print $lines[$i]->label;
for ($k = 0; $k < $level; $k++)
{
print '</div>';
if (count($arrayfields)>0 && !empty($arrayfields['t.description']['checked'])) {
print "<td>";
print $lines[$i]->description;
print "</td>\n";
}
if ($showlineingray) print '</i>';
//else print '</a>';
print "</td>\n";
// Date start
print '<td class="center">';
print dol_print_date($lines[$i]->date_start, 'dayhour');
print '</td>';
if (count($arrayfields)>0 && !empty($arrayfields['t.dateo']['checked'])) {
print '<td class="center">';
print dol_print_date($lines[$i]->date_start, 'dayhour');
print '</td>';
}
// Date end
print '<td class="center">';
print dol_print_date($lines[$i]->date_end, 'dayhour');
if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late"));
print '</td>';
if (count($arrayfields)>0 && !empty($arrayfields['t.datee']['checked'])) {
print '<td class="center">';
print dol_print_date($lines[$i]->date_end, 'dayhour');
if ($taskstatic->hasDelay())
print img_warning($langs->trans("Late"));
print '</td>';
}
$plannedworkloadoutputformat = 'allhourmin';
$timespentoutputformat = 'allhourmin';
@ -532,79 +544,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 '<td class="right">';
$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 '<br>('.$workingdelay.')';
if (count($arrayfields)>0 && !empty($arrayfields['t.planned_workload']['checked'])) {
print '<td class="right">';
$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 '<br>('.$workingdelay.')';
}
//else print '--:--';
print '</td>';
}
//else print '--:--';
print '</td>';
// Time spent
print '<td class="right">';
if ($showlineingray) print '<i>';
else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject ? '' : '&withproject=1').'">';
if ($lines[$i]->duration) print convertSecondToTime($lines[$i]->duration, $timespentoutputformat);
else print '--:--';
if ($showlineingray) print '</i>';
else print '</a>';
print '</td>';
if (count($arrayfields)>0 && !empty($arrayfields['t.duration_effective']['checked'])) {
print '<td class="right">';
if ($showlineingray)
print '<i>';
else print '<a href="' . DOL_URL_ROOT . '/projet/tasks/time.php?id=' . $lines[$i]->id . ($showproject ? '' : '&withproject=1') . '">';
if ($lines[$i]->duration)
print convertSecondToTime($lines[$i]->duration, $timespentoutputformat);
else print '--:--';
if ($showlineingray)
print '</i>';
else print '</a>';
print '</td>';
}
// Progress calculated (Note: ->duration is time spent)
print '<td class="right">';
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 '<span class="opacitymedium">'.$langs->trans('WorkloadNotDefined').'</span>';
if (count($arrayfields)>0 && !empty($arrayfields['t.progress_calculated']['checked'])) {
print '<td class="right">';
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 '<span class="opacitymedium">' . $langs->trans('WorkloadNotDefined') . '</span>';
}
print '</td>';
}
print '</td>';
// Progress declared
print '<td class="right">';
if ($lines[$i]->progress != '')
{
print getTaskProgressBadge($taskstatic);
if (count($arrayfields)>0 && !empty($arrayfields['t.progress']['checked'])) {
print '<td class="right">';
if ($lines[$i]->progress != '') {
print getTaskProgressBadge($taskstatic);
}
print '</td>';
}
print '</td>';
// resume
print '<td class="right">';
if ($lines[$i]->progress != '' && $lines[$i]->duration) {
print getTaskProgressView($taskstatic, false, false);
}
print '</td>';
if (count($arrayfields)>0 && !empty($arrayfields['t.progress_summary']['checked'])) {
print '<td class="right">';
if ($lines[$i]->progress != '' && $lines[$i]->duration) {
print getTaskProgressView($taskstatic, false, false);
}
print '</td>';
}
if ($showbilltime)
{
// Time not billed
print '<td class="right">';
if ($lines[$i]->usage_bill_time)
{
print convertSecondToTime($lines[$i]->tobill, 'allhourmin');
$total_projectlinesa_tobill += $lines[$i]->tobill;
}
else
{
print '<span class="opacitymedium">'.$langs->trans("NA").'</span>';
}
print '</td>';
if (count($arrayfields)>0 && !empty($arrayfields['t.tobill']['checked'])) {
print '<td class="right">';
if ($lines[$i]->usage_bill_time) {
print convertSecondToTime($lines[$i]->tobill, 'allhourmin');
$total_projectlinesa_tobill += $lines[$i]->tobill;
} else {
print '<span class="opacitymedium">' . $langs->trans("NA") . '</span>';
}
print '</td>';
}
// Time billed
print '<td class="right">';
if ($lines[$i]->usage_bill_time)
{
print convertSecondToTime($lines[$i]->billed, 'allhourmin');
$total_projectlinesa_billed += $lines[$i]->billed;
}
else
{
print '<span class="opacitymedium">'.$langs->trans("NA").'</span>';
}
print '</td>';
if (count($arrayfields)>0 && !empty($arrayfields['t.billed']['checked'])) {
print '<td class="right">';
if ($lines[$i]->usage_bill_time) {
print convertSecondToTime($lines[$i]->billed, 'allhourmin');
$total_projectlinesa_billed += $lines[$i]->billed;
} else {
print '<span class="opacitymedium">' . $langs->trans("NA") . '</span>';
}
print '</td>';
}
}
// Contacts of task
@ -628,6 +649,15 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
print '</td>';
}
// 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 +671,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 +693,23 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
print '<tr class="liste_total nodrag nodrop">';
print '<td class="liste_total">'.$langs->trans("Total").'</td>';
if ($showproject) print '<td></td><td></td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '<td class="nowrap liste_total right">';
print convertSecondToTime($total_projectlinesa_planned, 'allhourmin');
print '</td>';
print '<td class="nowrap liste_total right">';
if ($projectidfortotallink > 0) print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject ? '' : '&withproject=1').'">';
print convertSecondToTime($total_projectlinesa_spent, 'allhourmin');
if ($projectidfortotallink > 0) print '</a>';
print '</td>';
if (count($arrayfields)>0 && !empty($arrayfields['t.label']['checked'])) print '<td></td>';
if (count($arrayfields)>0 && !empty($arrayfields['t.dateo']['checked'])) print '<td></td>';
if (count($arrayfields)>0 && !empty($arrayfields['t.datee']['checked'])) print '<td></td>';
if (count($arrayfields)>0 && !empty($arrayfields['t.planned_workload']['checked'])) {
print '<td class="nowrap liste_total right">';
print convertSecondToTime($total_projectlinesa_planned, 'allhourmin');
print '</td>';
}
if (count($arrayfields)>0 && !empty($arrayfields['t.duration_effective']['checked'])) {
print '<td class="nowrap liste_total right">';
if ($projectidfortotallink > 0)
print '<a href="' . DOL_URL_ROOT . '/projet/tasks/time.php?projectid=' . $projectidfortotallink . ($showproject ? '' : '&withproject=1') . '">';
print convertSecondToTime($total_projectlinesa_spent, 'allhourmin');
if ($projectidfortotallink > 0)
print '</a>';
print '</td>';
}
if ($total_projectlinesa_planned) {
$totalAverageDeclaredProgress = round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2);
@ -698,33 +734,45 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
}
}
print '<td class="nowrap liste_total right">';
if ($total_projectlinesa_planned) print $totalCalculatedProgress.' %';
print '</td>';
print '<td class="nowrap liste_total right">';
if ($total_projectlinesa_planned) print '<span class="'.$badgeClass.'" >'.$totalAverageDeclaredProgress.' %</span>';
print '</td>';
if (count($arrayfields)>0 && !empty($arrayfields['t.progress_calculated']['checked'])) {
print '<td class="nowrap liste_total right">';
if ($total_projectlinesa_planned)
print $totalCalculatedProgress . ' %';
print '</td>';
}
if (count($arrayfields)>0 && !empty($arrayfields['t.progress']['checked'])) {
print '<td class="nowrap liste_total right">';
if ($total_projectlinesa_planned)
print '<span class="' . $badgeClass . '" >' . $totalAverageDeclaredProgress . ' %</span>';
print '</td>';
}
// resume
print '<td class="right">';
if ($total_projectlinesa_planned) {
print '</span>';
print ' <div class="progress sm" title="'.$totalAverageDeclaredProgress.'%" >';
print ' <div class="progress-bar '.$progressBarClass.'" style="width: '.$totalAverageDeclaredProgress.'%"></div>';
print ' </div>';
print '</div>';
}
print '</td>';
if (count($arrayfields)>0 && !empty($arrayfields['t.progress_summary']['checked'])) {
print '<td class="right">';
if ($total_projectlinesa_planned) {
print '</span>';
print ' <div class="progress sm" title="' . $totalAverageDeclaredProgress . '%" >';
print ' <div class="progress-bar ' . $progressBarClass . '" style="width: ' . $totalAverageDeclaredProgress . '%"></div>';
print ' </div>';
print '</div>';
}
print '</td>';
}
if ($showbilltime)
{
print '<td class="nowrap liste_total right">';
print convertSecondToTime($total_projectlinesa_tobill, 'allhourmin');
print '</td>';
print '<td class="nowrap liste_total right">';
print convertSecondToTime($total_projectlinesa_billed, 'allhourmin');
print '</td>';
if (count($arrayfields)>0 && !empty($arrayfields['t.tobill']['checked'])) {
print '<td class="nowrap liste_total right">';
print convertSecondToTime($total_projectlinesa_tobill, 'allhourmin');
print '</td>';
}
if (count($arrayfields)>0 && !empty($arrayfields['t.billed']['checked'])) {
print '<td class="nowrap liste_total right">';
print convertSecondToTime($total_projectlinesa_billed, 'allhourmin');
print '</td>';
}
}
// Contacts of task
if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST))

View File

@ -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";
}
}
}

View File

@ -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

View File

@ -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
ProductsToProduce=Products to produce
UnitCost=Unit cost
TotalCost=Total cost

View File

@ -266,3 +266,4 @@ InvoiceToUse=Draft invoice to use
NewInvoice=New invoice
OneLinePerTask=One line per task
OneLinePerPeriod=One line per period
RefTaskParent=Ref. Parent Task

View File

@ -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

View File

@ -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,10 @@ class Product extends CommonObject
}
}
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('loadStatsCustomerProposal', $parameters, $this, $action);
if ($reshook > 0) $this->stats_propale = $hookmanager->resArray['stats_propale'];
return 1;
}
else
@ -2517,8 +2520,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 +2546,11 @@ 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;
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('loadStatsSupplierProposal', $parameters, $this, $action);
if ($reshook > 0) $this->stats_proposal_supplier = $hookmanager->resArray['stats_proposal_supplier'];
return 1;
}
else
@ -2566,7 +2573,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";
@ -2644,6 +2651,9 @@ class Product extends CommonObject
}
}
$parameters = array('socid' => $socid, 'filtrestatut' => $filtrestatut, 'forVirtualStock' => $forVirtualStock);
$reshook = $hookmanager->executeHooks('loadStatsCustomerOrder', $parameters, $this, $action);
if ($reshook > 0) $this->stats_commande = $hookmanager->resArray['stats_commande'];
return 1;
}
else
@ -2665,7 +2675,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 +2706,11 @@ 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;
$parameters = array('socid' => $socid, 'filtrestatut' => $filtrestatut, 'forVirtualStock' => $forVirtualStock);
$reshook = $hookmanager->executeHooks('loadStatsSupplierOrder', $parameters, $this, $action);
if ($reshook > 0) $this->stats_commande_fournisseur = $hookmanager->resArray['stats_commande_fournisseur'];
return 1;
}
else
@ -2718,7 +2733,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 +2790,11 @@ class Product extends CommonObject
}
}
}
$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 +2816,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 +2843,11 @@ 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;
$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 +2869,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 +2935,10 @@ 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;
$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 +2958,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 +3008,11 @@ class Product extends CommonObject
}
}
}
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('loadStatsContract', $parameters, $this, $action);
if ($reshook > 0) $this->stats_contrat = $hookmanager->resArray['stats_contrat'];
return 1;
}
else
@ -2999,7 +3032,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 +3082,11 @@ class Product extends CommonObject
}
}
}
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('loadStatsCustomerInvoice', $parameters, $this, $action);
if ($reshook > 0) $this->stats_facture = $hookmanager->resArray['stats_facture'];
return 1;
}
else
@ -3068,8 +3106,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 +3135,11 @@ 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;
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('loadStatsSupplierInvoice', $parameters, $this, $action);
if ($reshook > 0) $this->stats_facture_fournisseur = $hookmanager->resArray['stats_facture_fournisseur'];
return 1;
}
else

View File

@ -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)."'";
@ -743,11 +741,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();
@ -759,6 +758,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']))
@ -853,12 +853,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']))
@ -871,6 +880,7 @@ class Task extends CommonObject
}
}
$sql .= " ORDER BY p.ref, t.rang, t.dateo";
//print $sql;exit;

View File

@ -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,36 @@ $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),
);
// 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 +207,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 +334,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&oacute;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 +358,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 +441,6 @@ if ($id > 0 || !empty($ref))
else print $langs->trans('PrivateProject');
print '</td></tr>';
/*if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
// Opportunity status
print '<tr><td>'.$langs->trans("OpportunityStatus").'</td><td>';
$code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code');
if ($code) print $langs->trans("OppStatus".$code);
print '</td></tr>';
// Opportunity percent
print '<tr><td>'.$langs->trans("OpportunityProbability").'</td><td>';
if (strcmp($object->opp_percent,'')) print price($object->opp_percent,'',$langs,1,0).' %';
print '</td></tr>';
// Opportunity Amount
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td><td>';
if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,1,0,0,$conf->currency);
print '</td></tr>';
}*/
// Date start - end
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
$start = dol_print_date($object->date_start, 'day');
@ -618,27 +615,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 '<br>';
// Link to create task
@ -654,7 +636,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 '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
@ -674,7 +655,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 +685,90 @@ elseif ($id > 0 || !empty($ref))
print '</div>';
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<div class="div-table-responsive">';
print '<table id="tablelines" class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">';
// Fields title search
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre">';
print '<input class="flat searchstring maxwidth50" type="text" name="search_taskref" value="'.dol_escape_htmltag($search_taskref).'">';
print '</td>';
if (!empty($arrayfields['t.ref']['checked'])) {
print '<td class="liste_titre">';
print '<input class="flat searchstring maxwidth50" type="text" name="search_taskref" value="' . dol_escape_htmltag($search_taskref) . '">';
print '</td>';
}
print '<td class="liste_titre">';
print '<input class="flat searchstring maxwidth100" type="text" name="search_tasklabel" value="'.dol_escape_htmltag($search_tasklabel).'">';
print '</td>';
if (!empty($arrayfields['t.label']['checked'])) {
print '<td class="liste_titre">';
print '<input class="flat searchstring maxwidth100" type="text" name="search_tasklabel" value="' . dol_escape_htmltag($search_tasklabel) . '">';
print '</td>';
}
print '<td class="liste_titre center">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_dtstartday" value="'.$search_dtstartday.'">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_dtstartmonth" value="'.$search_dtstartmonth.'">';
$formother->select_year($search_dtstartyear ? $search_dtstartyear : -1, 'search_dtstartyear', 1, 20, 5);
print '</td>';
if (!empty($arrayfields['t.description']['checked'])) {
print '<td class="liste_titre">';
print '<input class="flat searchstring maxwidth100" type="text" name="search_taskdescription" value="' . dol_escape_htmltag($search_taskdescription) . '">';
print '</td>';
}
print '<td class="liste_titre center">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_dtendday" value="'.$search_dtendday.'">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_dtendmonth" value="'.$search_dtendmonth.'">';
$formother->select_year($search_dtendyear ? $search_dtendyear : -1, 'search_dtendyear', 1, 20, 5);
print '</td>';
if (!empty($arrayfields['t.dateo']['checked'])) {
print '<td class="liste_titre center">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_dtstartday" value="' . $search_dtstartday . '">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_dtstartmonth" value="' . $search_dtstartmonth . '">';
$formother->select_year($search_dtstartyear ? $search_dtstartyear : -1, 'search_dtstartyear', 1, 20, 5);
print '</td>';
}
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_planedworkload" value="'.$search_planedworkload.'">';
print '</td>';
if (!empty($arrayfields['t.datee']['checked'])) {
print '<td class="liste_titre center">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_dtendday" value="' . $search_dtendday . '">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_dtendmonth" value="' . $search_dtendmonth . '">';
$formother->select_year($search_dtendyear ? $search_dtendyear : -1, 'search_dtendyear', 1, 20, 5);
print '</td>';
}
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_timespend" value="'.$search_timespend.'">';
print '</td>';
if (!empty($arrayfields['t.planned_workload']['checked'])) {
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_planedworkload" value="' . $search_planedworkload . '">';
print '</td>';
}
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_progresscalc" value="'.$search_progresscalc.'">';
print '</td>';
if (!empty($arrayfields['t.duration_effective']['checked'])) {
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_timespend" value="' . $search_timespend . '">';
print '</td>';
}
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_progressdeclare" value="'.$search_progressdeclare.'">';
print '</td>';
if (!empty($arrayfields['t.progress_calculated']['checked'])) {
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_progresscalc" value="' . $search_progresscalc . '">';
print '</td>';
}
if (!empty($arrayfields['t.progress']['checked'])) {
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_progressdeclare" value="' . $search_progressdeclare . '">';
print '</td>';
}
// progress resume not searchable
print '<td class="liste_titre right"></td>';
if ($object->usage_bill_time)
{
print '<td class="liste_titre right">';
print '</td>';
if (!empty($arrayfields['t.tobill']['checked'])) {
print '<td class="liste_titre right">';
print '</td>';
}
print '<td class="liste_titre right">';
print '</td>';
if (!empty($arrayfields['t.billed']['checked'])) {
print '<td class="liste_titre right">';
print '</td>';
}
}
if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print '<td></td>';
if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print '<td class="liste_titre"></td>';
$extrafieldsobjectkey=$taskstatic->table_element;
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Action column
print '<td class="liste_titre maxwidthsearch">';
@ -772,29 +779,37 @@ elseif ($id > 0 || !empty($ref))
print '<tr class="liste_titre nodrag nodrop">';
// print '<td>'.$langs->trans("Project").'</td>';
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
$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);
$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 "</tr>\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
{

View File

@ -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 '<div class="div-table-responsive">';
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'" id="tablelines3">'."\n";
print '<tr class="liste_titre_filter">';
if (!empty($arrayfields['t.fk_task_parent']['checked']))
{
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_task_ref_parent" value="'.dol_escape_htmltag($search_task_ref_parent).'" size="4">';
print '</td>';
}
if (!empty($arrayfields['t.ref']['checked']))
{
print '<td class="liste_titre">';
@ -503,6 +518,13 @@ if (!empty($arrayfields['t.label']['checked']))
print '<input type="text" class="flat" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'" size="8">';
print '</td>';
}
//Task Description
if (!empty($arrayfields['t.description']['checked']))
{
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_task_description" value="'.dol_escape_htmltag($search_task_description).'" size="8">';
print '</td>';
}
// Start date
if (!empty($arrayfields['t.dateo']['checked']))
{
@ -581,17 +603,19 @@ print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
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 '<tr data-rowid="'.$object->id.'" class="oddeven">';
// Ref Parent
if (!empty($arrayfields['t.fk_task_parent']['checked'])) {
print '<td class="nowraponall">';
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 '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Ref
if (!empty($arrayfields['t.ref']['checked']))
{
@ -659,6 +702,14 @@ while ($i < min($num, $limit))
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Description
if (!empty($arrayfields['t.description']['checked']))
{
print '<td>';
print $object->description;
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Date start
if (!empty($arrayfields['t.dateo']['checked']))
{
@ -874,13 +925,11 @@ while ($i < min($num, $limit))
print "</tr>\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']))
{

View File

@ -11,6 +11,7 @@
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
*
* 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);
}
@ -839,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;
@ -854,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

View File

@ -14,6 +14,7 @@
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
*
* 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)

View File

@ -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;