2
0
forked from Wavyzz/dolibarr

Debug v18

This commit is contained in:
Laurent Destailleur
2023-06-29 15:54:09 +02:00
parent 046ce4dc59
commit b4c448a420
14 changed files with 158 additions and 166 deletions

View File

@@ -319,12 +319,12 @@ for ($i = 1 ; $i < $MAXLINES; $i++) {
print '<tr class="oddeven nowraponall '.$classi.'"><td>'; print '<tr class="oddeven nowraponall '.$classi.'"><td>';
print img_picto('', 'bank_account', 'class="paddingright"'); print img_picto('', 'bank_account', 'class="paddingright"');
$form->select_comptes(($error ? GETPOST($i.'_account_from', 'int') : ''), $i.'_account_from', 0, '', 1, ($i <= $maxtab ? 'view=view' : ''), isModEnabled('multicurrency') ? 1 : 0, 'minwidth100'); $form->select_comptes(($error ? GETPOST($i.'_account_from', 'int') : ''), $i.'_account_from', 0, '', 1, '', isModEnabled('multicurrency') ? 1 : 0, 'minwidth100');
print '</td>'; print '</td>';
print '<td class="nowraponall">'; print '<td class="nowraponall">';
print img_picto('', 'bank_account', 'class="paddingright"'); print img_picto('', 'bank_account', 'class="paddingright"');
$form->select_comptes(($error ? GETPOST($i.'_account_to', 'int') : ''), $i.'_account_to', 0, '', 1, ($i <= $maxtab ? 'view=view' : ''), isModEnabled('multicurrency') ? 1 : 0, 'minwidth100'); $form->select_comptes(($error ? GETPOST($i.'_account_to', 'int') : ''), $i.'_account_to', 0, '', 1, '', isModEnabled('multicurrency') ? 1 : 0, 'minwidth100');
print "</td>\n"; print "</td>\n";
// Payment mode // Payment mode

View File

@@ -505,12 +505,16 @@ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '</tr>'."\n"; print '</tr>'."\n";
$totalarray = array();
$totalarray['nbfield'] = 0;
// Fields title label // Fields title label
// -------------------------------------------------------------------- // --------------------------------------------------------------------
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
// Action column // Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
$totalarray['nbfield']++;
} }
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
@@ -525,17 +529,19 @@ foreach ($object->fields as $key => $val) {
} }
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
$totalarray['nbfield']++;
} }
} }
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields // Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Action column // Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
$totalarray['nbfield']++;
} }
print '</tr>'."\n"; print '</tr>'."\n";
@@ -554,8 +560,8 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar
// Loop on record // Loop on record
// -------------------------------------------------------------------- // --------------------------------------------------------------------
$i = 0; $i = 0;
$totalarray = array();
$savnbfield = $totalarray['nbfield']; $savnbfield = $totalarray['nbfield'];
$totalarray = array();
$totalarray['nbfield'] = 0; $totalarray['nbfield'] = 0;
while ($i < ($limit ? min($num, $limit) : $num)) { while ($i < ($limit ? min($num, $limit) : $num)) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);

View File

@@ -106,6 +106,7 @@ class CashControl extends CommonObject
* @var int Object Id * @var int Object Id
*/ */
public $id; public $id;
public $label;
public $opening; public $opening;
public $status; public $status;
public $year_close; public $year_close;
@@ -127,6 +128,11 @@ class CashControl extends CommonObject
* @var integer|string $date_modification * @var integer|string $date_modification
*/ */
public $date_modification; public $date_modification;
/**
* @var integer|string $date_modification
* @deprecated
*/
public $tms;
/** /**
* @var integer|string $date_valid * @var integer|string $date_valid

View File

@@ -611,19 +611,19 @@ if ($action == 'new') {
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border centpercent">';
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('Date'); print $langs->trans('Date');
print '</td>'; print '</td>';
if ($action != 'editdate') { if ($action != 'editdate') {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="2">';
print '</td><td>';
if ($action == 'editdate') { if ($action == 'editdate') {
print '<form name="setdate" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">'; print '<form name="setdate" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
@@ -638,51 +638,43 @@ if ($action == 'new') {
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// External ref // External ref - Ext ref are not visible field on standard usage
/* Ext ref are not visible field on standard usage if (getDolGlobalString('MAIN_SHOW_EXTREF')) {
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print $langs->trans('RefExt');
print $langs->trans('RefExt'); print '</td>';
print '</td>'; if ($action != 'editrefext') {
if ($action != 'editrefext') print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editrefext&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetRefExt'),1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editrefext&token='.newToken().'&id='.((int) $object->id).'">'.img_edit($langs->trans('SetRefExt'), 1).'</a></td>';
print '</tr></table>'; }
print '</td><td colspan="2">'; print '</tr></table>';
if ($action == 'editrefext') print '</td><td>';
{ if ($action == 'editrefext') {
print '<form name="setrefext" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">'; print '<form name="setrefext" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setrefext">'; print '<input type="hidden" name="action" value="setrefext">';
print '<input type="text" name="ref_ext" value="'.$object->ref_ext.'">'; print '<input type="text" name="ref_ext" value="'.$object->ref_ext.'">';
print '<input type="submit" class="button button-edit" value="'.$langs->trans('Modify').'">'; print '<input type="submit" class="button button-edit" value="'.$langs->trans('Modify').'">';
print '</form>'; print '</form>';
} } else {
else print $object->ref_ext;
{ }
print $object->ref_ext; print '</td></tr>';
} }
print '</td>'; print '<tr><td>'.$langs->trans('Account').'</td><td>';
print '</tr>';
*/
print '<tr><td>'.$langs->trans('Account').'</td><td colspan="2">';
print $accountstatic->getNomUrl(1); print $accountstatic->getNomUrl(1);
print '</td></tr>'; print '</td></tr>';
// Number of bank checks // Number of bank checks
print '<tr><td>'.$langs->trans('NbOfCheques').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('NbOfCheques').'</td><td>';
print $object->nbcheque; print $object->nbcheque;
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans('Total').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('Total').'</td><td>';
print price($object->amount); print '<span class="amount">'.price($object->amount).'</span>';
print '</td></tr>'; print '</td></tr>';
/*print '<tr><td>'.$langs->trans('Status').'</td><td colspan="2">';
print $object->getLibStatut(4);
print '</td></tr>';*/
print '</table><br>'; print '</table><br>';
print '</div>'; print '</div>';

View File

@@ -79,8 +79,6 @@ class RemiseCheque extends CommonObject
public function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
$this->next_id = 0;
$this->previous_id = 0;
} }
/** /**
@@ -810,47 +808,6 @@ class RemiseCheque extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge les proprietes ref_previous et ref_next
*
* @return int <0 if KO, 0 if OK
*/
public function load_previous_next_id()
{
// phpcs:enable
global $conf;
$this->errno = 0;
$sql = "SELECT MAX(rowid)";
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
$sql .= " WHERE rowid < ".((int) $this->id);
$sql .= " AND entity = ".$conf->entity;
$result = $this->db->query($sql);
if (!$result) {
$this->errno = -1035;
}
$row = $this->db->fetch_row($result);
$this->previous_id = $row[0];
$sql = "SELECT MIN(rowid)";
$sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
$sql .= " WHERE rowid > ".((int) $this->id);
$sql .= " AND entity = ".$conf->entity;
$result = $this->db->query($sql);
if (!$result) {
$this->errno = -1035;
}
$row = $this->db->fetch_row($result);
$this->next_id = $row[0];
return $this->errno;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set the creation date * Set the creation date

View File

@@ -9930,13 +9930,17 @@ function printCommonFooter($zone = 'private')
* Split a string with 2 keys into key array. * Split a string with 2 keys into key array.
* For example: "A=1;B=2;C=2" is exploded into array('A'=>1,'B'=>2,'C'=>3) * For example: "A=1;B=2;C=2" is exploded into array('A'=>1,'B'=>2,'C'=>3)
* *
* @param string $string String to explode * @param string|null $string String to explode
* @param string $delimiter Delimiter between each couple of data. Example: ';' or '[\n;]+' or '(\n\r|\r|\n|;)' * @param string $delimiter Delimiter between each couple of data. Example: ';' or '[\n;]+' or '(\n\r|\r|\n|;)'
* @param string $kv Delimiter between key and value * @param string $kv Delimiter between key and value
* @return array Array of data exploded * @return array Array of data exploded
*/ */
function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=') function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=')
{ {
if (is_null($string)) {
return array();
}
if (preg_match('/^\[.*\]$/sm', $delimiter) || preg_match('/^\(.*\)$/sm', $delimiter)) { if (preg_match('/^\[.*\]$/sm', $delimiter) || preg_match('/^\(.*\)$/sm', $delimiter)) {
// This is a regex string // This is a regex string
$newdelimiter = $delimiter; $newdelimiter = $delimiter;

View File

@@ -590,13 +590,13 @@ function project_admin_prepare_head()
* @param int $projectsListId List of id of project allowed to user (string separated with comma) * @param int $projectsListId List of id of project allowed to user (string separated with comma)
* @param int $addordertick Add a tick to move task * @param int $addordertick Add a tick to move task
* @param int $projectidfortotallink 0 or Id of project to use on total line (link to see all time consumed for project) * @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 $dummy Not used.
* @param string $showbilltime Add the column 'TimeToBill' and 'TimeBilled' * @param string $showbilltime Add the column 'TimeToBill' and 'TimeBilled'
* @param array $arrayfields Array with displayed coloumn information * @param array $arrayfields Array with displayed coloumn information
* @param array $arrayofselected Array with selected fields * @param array $arrayofselected Array with selected fields
* @return int Nb of tasks shown * @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(), $arrayofselected = array()) function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $dummy = '', $showbilltime = 0, $arrayfields = array(), $arrayofselected = array())
{ {
global $user, $langs, $conf, $db, $hookmanager; global $user, $langs, $conf, $db, $hookmanager;
global $projectstatic, $taskstatic, $extrafields; global $projectstatic, $taskstatic, $extrafields;
@@ -604,17 +604,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
$lastprojectid = 0; $lastprojectid = 0;
$projectsArrayId = explode(',', $projectsListId); $projectsArrayId = explode(',', $projectsListId);
if ($filterprogresscalc !== '') {
foreach ($lines as $key => $line) {
if (!empty($line->planned_workload) && !empty($line->duration)) {
$filterprogresscalc = str_replace(' = ', ' == ', $filterprogresscalc);
if (!eval($filterprogresscalc)) {
unset($lines[$key]);
}
}
}
$lines = array_values($lines);
}
$numlines = count($lines); $numlines = count($lines);
// We declare counter as global because we want to edit them into recursive call // We declare counter as global because we want to edit them into recursive call
@@ -699,7 +689,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
$taskstatic->date_end = $lines[$i]->date_end; $taskstatic->date_end = $lines[$i]->date_end;
$taskstatic->datee = $lines[$i]->date_end; // deprecated $taskstatic->datee = $lines[$i]->date_end; // deprecated
$taskstatic->planned_workload = $lines[$i]->planned_workload; $taskstatic->planned_workload = $lines[$i]->planned_workload;
$taskstatic->duration_effective = $lines[$i]->duration; $taskstatic->duration_effective = $lines[$i]->duration_effective;
$taskstatic->budget_amount = $lines[$i]->budget_amount; $taskstatic->budget_amount = $lines[$i]->budget_amount;
// Action column // Action column
@@ -819,8 +809,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
} else { } else {
print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject ? '' : '&withproject=1').'">'; print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject ? '' : '&withproject=1').'">';
} }
if ($lines[$i]->duration) { if ($lines[$i]->duration_effective) {
print convertSecondToTime($lines[$i]->duration, $timespentoutputformat); print convertSecondToTime($lines[$i]->duration_effective, $timespentoutputformat);
} else { } else {
print '--:--'; print '--:--';
} }
@@ -832,12 +822,12 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
print '</td>'; print '</td>';
} }
// Progress calculated (Note: ->duration is time spent) // Progress calculated (Note: ->duration_effective is time spent)
if (count($arrayfields) > 0 && !empty($arrayfields['t.progress_calculated']['checked'])) { if (count($arrayfields) > 0 && !empty($arrayfields['t.progress_calculated']['checked'])) {
$s = ''; $shtml = ''; $s = ''; $shtml = '';
if ($lines[$i]->planned_workload || $lines[$i]->duration) { if ($lines[$i]->planned_workload || $lines[$i]->duration_effective) {
if ($lines[$i]->planned_workload) { if ($lines[$i]->planned_workload) {
$s = round(100 * $lines[$i]->duration / $lines[$i]->planned_workload, 2).' %'; $s = round(100 * $lines[$i]->duration_effective / $lines[$i]->planned_workload, 2).' %';
$shtml = $s; $shtml = $s;
} else { } else {
$s = $langs->trans('WorkloadNotDefined'); $s = $langs->trans('WorkloadNotDefined');
@@ -861,7 +851,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// resume // resume
if (count($arrayfields) > 0 && !empty($arrayfields['t.progress_summary']['checked'])) { if (count($arrayfields) > 0 && !empty($arrayfields['t.progress_summary']['checked'])) {
print '<td class="right">'; print '<td class="right">';
if ($lines[$i]->progress != '' && $lines[$i]->duration) { if ($lines[$i]->progress != '' && $lines[$i]->duration_effective) {
print getTaskProgressView($taskstatic, false, false); print getTaskProgressView($taskstatic, false, false);
} }
print '</td>'; print '</td>';
@@ -974,15 +964,15 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
if ($level >= 0) { // Call sublevels if ($level >= 0) { // Call sublevels
$level++; $level++;
if ($lines[$i]->id) { if ($lines[$i]->id) {
projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick, $projectidfortotallink, $filterprogresscalc, $showbilltime, $arrayfields); projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick, $projectidfortotallink, '', $showbilltime, $arrayfields);
} }
$level--; $level--;
} }
$total_projectlinesa_spent += $lines[$i]->duration; $total_projectlinesa_spent += $lines[$i]->duration_effective;
$total_projectlinesa_planned += $lines[$i]->planned_workload; $total_projectlinesa_planned += $lines[$i]->planned_workload;
if ($lines[$i]->planned_workload) { if ($lines[$i]->planned_workload) {
$total_projectlinesa_spent_if_planned += $lines[$i]->duration; $total_projectlinesa_spent_if_planned += $lines[$i]->duration_effective;
} }
if ($lines[$i]->planned_workload) { if ($lines[$i]->planned_workload) {
$total_projectlinesa_declared_if_planned += $lines[$i]->planned_workload * $lines[$i]->progress / 100; $total_projectlinesa_declared_if_planned += $lines[$i]->planned_workload * $lines[$i]->progress / 100;
@@ -1627,10 +1617,10 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
if (!empty($arrayfields['timeconsumed']['checked'])) { if (!empty($arrayfields['timeconsumed']['checked'])) {
// Time spent by everybody // Time spent by everybody
print '<td class="right">'; print '<td class="right">';
// $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consumed by user // $lines[$i]->duration_effective is a denormalised field = summ of time spent by everybody for task. What we need is time consumed by user
if ($lines[$i]->duration) { if ($lines[$i]->duration_effective) {
print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">'; print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">';
print convertSecondToTime($lines[$i]->duration, 'allhourmin'); print convertSecondToTime($lines[$i]->duration_effective, 'allhourmin');
print '</a>'; print '</a>';
} else { } else {
print '--:--'; print '--:--';
@@ -2026,10 +2016,10 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
if (!empty($arrayfields['timeconsumed']['checked'])) { if (!empty($arrayfields['timeconsumed']['checked'])) {
// Time spent by everybody // Time spent by everybody
print '<td class="right">'; print '<td class="right">';
// $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consumed by user // $lines[$i]->duration_effective is a denormalised field = summ of time spent by everybody for task. What we need is time consumed by user
if ($lines[$i]->duration) { if ($lines[$i]->duration_effective) {
print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">'; print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">';
print convertSecondToTime($lines[$i]->duration, 'allhourmin'); print convertSecondToTime($lines[$i]->duration_effective, 'allhourmin');
print '</a>'; print '</a>';
} else { } else {
print '--:--'; print '--:--';
@@ -2320,10 +2310,10 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &
// Time spent by everybody // Time spent by everybody
print '<td class="right">'; print '<td class="right">';
// $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consumed by user // $lines[$i]->duration_effective is a denormalised field = summ of time spent by everybody for task. What we need is time consumed by user
if ($lines[$i]->duration) { if ($lines[$i]->duration_effective) {
print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">'; print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">';
print convertSecondToTime($lines[$i]->duration, 'allhourmin'); print convertSecondToTime($lines[$i]->duration_effective, 'allhourmin');
print '</a>'; print '</a>';
} else { } else {
print '--:--'; print '--:--';

View File

@@ -665,36 +665,49 @@ if ($resql) {
print "</tr>\n"; print "</tr>\n";
$totalarray = array();
$totalarray['nbfield'] = 0;
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
$totalarray['nbfield']++;
} }
if (!empty($arrayfields['d.ref']['checked'])) { if (!empty($arrayfields['d.ref']['checked'])) {
print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], "d.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], "d.ref", "", $param, '', $sortfield, $sortorder);
$totalarray['nbfield']++;
} }
if (!empty($arrayfields['user']['checked'])) { if (!empty($arrayfields['user']['checked'])) {
print_liste_field_titre($arrayfields['user']['label'], $_SERVER["PHP_SELF"], "u.lastname", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($arrayfields['user']['label'], $_SERVER["PHP_SELF"], "u.lastname", "", $param, '', $sortfield, $sortorder);
$totalarray['nbfield']++;
} }
if (!empty($arrayfields['d.date_debut']['checked'])) { if (!empty($arrayfields['d.date_debut']['checked'])) {
print_liste_field_titre($arrayfields['d.date_debut']['label'], $_SERVER["PHP_SELF"], "d.date_debut", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($arrayfields['d.date_debut']['label'], $_SERVER["PHP_SELF"], "d.date_debut", "", $param, 'align="center"', $sortfield, $sortorder);
$totalarray['nbfield']++;
} }
if (!empty($arrayfields['d.date_fin']['checked'])) { if (!empty($arrayfields['d.date_fin']['checked'])) {
print_liste_field_titre($arrayfields['d.date_fin']['label'], $_SERVER["PHP_SELF"], "d.date_fin", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($arrayfields['d.date_fin']['label'], $_SERVER["PHP_SELF"], "d.date_fin", "", $param, 'align="center"', $sortfield, $sortorder);
$totalarray['nbfield']++;
} }
if (!empty($arrayfields['d.date_valid']['checked'])) { if (!empty($arrayfields['d.date_valid']['checked'])) {
print_liste_field_titre($arrayfields['d.date_valid']['label'], $_SERVER["PHP_SELF"], "d.date_valid", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($arrayfields['d.date_valid']['label'], $_SERVER["PHP_SELF"], "d.date_valid", "", $param, 'align="center"', $sortfield, $sortorder);
$totalarray['nbfield']++;
} }
if (!empty($arrayfields['d.date_approve']['checked'])) { if (!empty($arrayfields['d.date_approve']['checked'])) {
print_liste_field_titre($arrayfields['d.date_approve']['label'], $_SERVER["PHP_SELF"], "d.date_approve", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($arrayfields['d.date_approve']['label'], $_SERVER["PHP_SELF"], "d.date_approve", "", $param, 'align="center"', $sortfield, $sortorder);
$totalarray['nbfield']++;
} }
if (!empty($arrayfields['d.total_ht']['checked'])) { if (!empty($arrayfields['d.total_ht']['checked'])) {
print_liste_field_titre($arrayfields['d.total_ht']['label'], $_SERVER["PHP_SELF"], "d.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($arrayfields['d.total_ht']['label'], $_SERVER["PHP_SELF"], "d.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
$totalarray['nbfield']++;
} }
if (!empty($arrayfields['d.total_vat']['checked'])) { if (!empty($arrayfields['d.total_vat']['checked'])) {
print_liste_field_titre($arrayfields['d.total_vat']['label'], $_SERVER["PHP_SELF"], "d.total_tva", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($arrayfields['d.total_vat']['label'], $_SERVER["PHP_SELF"], "d.total_tva", "", $param, 'align="right"', $sortfield, $sortorder);
$totalarray['nbfield']++;
} }
if (!empty($arrayfields['d.total_ttc']['checked'])) { if (!empty($arrayfields['d.total_ttc']['checked'])) {
print_liste_field_titre($arrayfields['d.total_ttc']['label'], $_SERVER["PHP_SELF"], "d.total_ttc", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($arrayfields['d.total_ttc']['label'], $_SERVER["PHP_SELF"], "d.total_ttc", "", $param, 'align="right"', $sortfield, $sortorder);
$totalarray['nbfield']++;
} }
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
@@ -704,15 +717,19 @@ if ($resql) {
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (!empty($arrayfields['d.date_create']['checked'])) { if (!empty($arrayfields['d.date_create']['checked'])) {
print_liste_field_titre($arrayfields['d.date_create']['label'], $_SERVER["PHP_SELF"], "d.date_create", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); print_liste_field_titre($arrayfields['d.date_create']['label'], $_SERVER["PHP_SELF"], "d.date_create", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
$totalarray['nbfield']++;
} }
if (!empty($arrayfields['d.tms']['checked'])) { if (!empty($arrayfields['d.tms']['checked'])) {
print_liste_field_titre($arrayfields['d.tms']['label'], $_SERVER["PHP_SELF"], "d.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); print_liste_field_titre($arrayfields['d.tms']['label'], $_SERVER["PHP_SELF"], "d.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
$totalarray['nbfield']++;
} }
if (!empty($arrayfields['d.fk_statut']['checked'])) { if (!empty($arrayfields['d.fk_statut']['checked'])) {
print_liste_field_titre($arrayfields['d.fk_statut']['label'], $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($arrayfields['d.fk_statut']['label'], $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder);
$totalarray['nbfield']++;
} }
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
$totalarray['nbfield']++;
} }
print "</tr>\n"; print "</tr>\n";

View File

@@ -116,6 +116,7 @@ class Job extends CommonObject
); );
public $rowid; public $rowid;
public $ref; public $ref;
public $label;
public $description; public $description;
public $date_creation; public $date_creation;
public $tms; public $tms;
@@ -844,6 +845,9 @@ class Job extends CommonObject
public function LibStatut($status, $mode = 0) public function LibStatut($status, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
return ''; // There is no status on job profile for the moment
/*
if (empty($this->labelStatus) || empty($this->labelStatusShort)) { if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
global $langs; global $langs;
//$langs->load("hrm"); //$langs->load("hrm");
@@ -862,6 +866,7 @@ class Job extends CommonObject
} }
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
*/
} }
/** /**

View File

@@ -372,7 +372,7 @@ class Tasks extends DolibarrApi
*/ */
// /** // /**
// * Update a task to given project // * Update a task of a given project
// * // *
// * @param int $id Id of project to update // * @param int $id Id of project to update
// * @param int $taskid Id of task to update // * @param int $taskid Id of task to update

View File

@@ -1800,7 +1800,7 @@ class Project extends CommonObject
// Loop on each task, to clone it // Loop on each task, to clone it
foreach ($tasksarray as $tasktoclone) { foreach ($tasksarray as $tasktoclone) {
$result_clone = $taskstatic->createFromClone($user, $tasktoclone->id, $clone_project_id, $tasktoclone->fk_parent, $move_date, true, false, $clone_task_file, true, false); $result_clone = $taskstatic->createFromClone($user, $tasktoclone->id, $clone_project_id, $tasktoclone->fk_task_parent, $move_date, true, false, $clone_task_file, true, false);
if ($result_clone <= 0) { if ($result_clone <= 0) {
$this->error .= $taskstatic->error; $this->error .= $taskstatic->error;
$error++; $error++;

View File

@@ -135,11 +135,6 @@ class Task extends CommonObjectLine
public $comments = array(); public $comments = array();
/**
* @var float budget_amount
*/
public $budget_amount;
/** /**
* @var array * @var array
*/ */
@@ -150,12 +145,34 @@ class Task extends CommonObjectLine
*/ */
public $statuts_short; public $statuts_short;
// Properties to store project informations
public $projectref;
public $projectstatus;
public $projectlabel;
public $opp_amount;
public $opp_percent;
public $fk_opp_status;
public $usage_bill_time;
public $public;
// Properties to store thirdparty of project information
public $socid;
public $thirdparty_id;
public $thirdparty_name;
public $thirdparty_email;
/**
* @var float budget_amount
*/
public $budget_amount;
/** /**
* @var float project_budget_amount * @var float project_budget_amount
*/ */
public $project_budget_amount; public $project_budget_amount;
public $oldcopy;
/** /**
@@ -845,24 +862,24 @@ class Task extends CommonObjectLine
* Return list of tasks for all projects or for one particular project * Return list of tasks for all projects or for one particular project
* Sort order is on project, then on position of task, and last on start date of first level task * Sort order is on project, then on position of task, and last on start date of first level task
* *
* @param User $usert Object user to limit tasks affected to a particular user * @param User $usert Object user to limit tasks affected to a particular user
* @param User $userp Object user to limit projects of a particular user and public projects * @param User $userp Object user to limit projects of a particular user and public projects
* @param int $projectid Project id * @param int $projectid Project id
* @param int $socid Third party id * @param int $socid Third party id
* @param int $mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists * @param int $mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists
* @param string $filteronproj Filter on project ref or label * @param string $filteronproj Filter on project ref or label
* @param string $filteronprojstatus Filter on project status ('-1'=no filter, '0,1'=Draft+Validated only) * @param string $filteronprojstatus Filter on project status ('-1'=no filter, '0,1'=Draft+Validated only)
* @param string $morewherefilter Add more filter into where SQL request (must start with ' AND ...') * @param string $morewherefilter Add more filter into where SQL request (must start with ' AND ...')
* @param string $filteronprojuser Filter on user that is a contact of project * @param string $filteronprojuser Filter on user that is a contact of project
* @param string $filterontaskuser Filter on user assigned to task * @param string $filterontaskuser Filter on user assigned to task
* @param Extrafields $extrafields Show additional column from project or task * @param Extrafields $extrafields Show additional column from project or task
* @param int $includebilltime Calculate also the time to bill and billed * @param int $includebilltime Calculate also the time to bill and billed
* @param array $search_array_options Array of search * @param array $search_array_options Array of search filters. Not Used yet.
* @param int $loadextras Fetch all Extrafields on each task * @param int $loadextras Fetch all Extrafields on each task
* @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action * @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action
* @param string $sortfield Sort field * @param string $sortfield Sort field
* @param string $sortorder Sort order * @param string $sortorder Sort order
* @return array|string Array of tasks * @return array|string 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(), $loadextras = 0, $loadRoleMode = 1, $sortfield = '', $sortorder = '') 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(), $loadextras = 0, $loadRoleMode = 1, $sortfield = '', $sortorder = '')
{ {
@@ -1039,8 +1056,8 @@ class Task extends CommonObjectLine
$tasks[$i] = new Task($this->db); $tasks[$i] = new Task($this->db);
$tasks[$i]->id = $obj->taskid; $tasks[$i]->id = $obj->taskid;
$tasks[$i]->ref = $obj->taskref; $tasks[$i]->ref = $obj->taskref;
$tasks[$i]->fk_project = $obj->projectid; $tasks[$i]->fk_project = $obj->projectid;
$tasks[$i]->projectref = $obj->ref; $tasks[$i]->projectref = $obj->ref;
$tasks[$i]->projectlabel = $obj->plabel; $tasks[$i]->projectlabel = $obj->plabel;
$tasks[$i]->projectstatus = $obj->projectstatus; $tasks[$i]->projectstatus = $obj->projectstatus;
@@ -1053,9 +1070,8 @@ class Task extends CommonObjectLine
$tasks[$i]->label = $obj->label; $tasks[$i]->label = $obj->label;
$tasks[$i]->description = $obj->description; $tasks[$i]->description = $obj->description;
$tasks[$i]->fk_parent = $obj->fk_task_parent; // deprecated
$tasks[$i]->fk_task_parent = $obj->fk_task_parent; $tasks[$i]->fk_task_parent = $obj->fk_task_parent;
$tasks[$i]->duration = $obj->duration_effective; $tasks[$i]->duration_effective = $obj->duration_effective;
$tasks[$i]->planned_workload = $obj->planned_workload; $tasks[$i]->planned_workload = $obj->planned_workload;
if ($includebilltime) { if ($includebilltime) {

View File

@@ -288,19 +288,17 @@ if (!empty($search_timespend)) {
$morewherefilterarray[] = natural_search('t.duration_effective', $search_timespend, 1, 1); $morewherefilterarray[] = natural_search('t.duration_effective', $search_timespend, 1, 1);
} }
if (!empty($search_progresscalc)) {
$filterprogresscalc = 'if '.natural_search('round(100 * $line->duration / $line->planned_workload,2)', $search_progresscalc, 1, 1).'{return 1;} else {return 0;}';
} else {
$filterprogresscalc = '';
}
if (!empty($search_progressdeclare)) { if (!empty($search_progressdeclare)) {
$morewherefilterarray[] = natural_search('t.progress', $search_progressdeclare, 1, 1); $morewherefilterarray[] = natural_search('t.progress', $search_progressdeclare, 1, 1);
} }
if (!empty($search_progresscalc)) {
$morewherefilterarray[] = '(planned_workload IS NULL OR planned_workload = 0 OR '.natural_search('ROUND(100 * duration_effective / planned_workload, 2)', $search_progresscalc, 1, 1).')';
//natural_search('round(100 * $line->duration_effective / $line->planned_workload,2)', $filterprogresscalc, 1, 1).' {return 1;} else {return 0;}';
}
if ($search_task_budget_amount) { if ($search_task_budget_amount) {
$morewherefilterarray[]= natural_search('t.budget_amount', $search_task_budget_amount, 1, 1); $morewherefilterarray[]= natural_search('t.budget_amount', $search_task_budget_amount, 1, 1);
} }
//var_dump($morewherefilterarray);
$morewherefilter = ''; $morewherefilter = '';
if (count($morewherefilterarray) > 0) { if (count($morewherefilterarray) > 0) {
@@ -903,14 +901,12 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
} }
// Filter on categories // Filter on assigned users
$moreforfilter = ''; $moreforfilter = '';
if (count($tasksarray) > 0) { $moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= img_picto('', 'user', 'class="pictofixedwidth"');
$moreforfilter .= img_picto('', 'user', 'class="pictofixedwidth"'); $moreforfilter .= $form->select_dolusers($tmpuser->id > 0 ? $tmpuser->id : '', 'search_user_id', $langs->trans("TasksAssignedTo"), null, 0, '', '');
$moreforfilter .= $form->select_dolusers($tmpuser->id > 0 ? $tmpuser->id : '', 'search_user_id', $langs->trans("TasksAssignedTo"), null, 0, '', ''); $moreforfilter .= '</div>';
$moreforfilter .= '</div>';
}
if ($moreforfilter) { if ($moreforfilter) {
print '<div class="liste_titre liste_titre_bydiv centpercent">'; print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter; print $moreforfilter;
@@ -1128,7 +1124,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
if (count($tasksarray) > 0) { if (count($tasksarray) > 0) {
// Show all lines in taskarray (recursive function to go down on tree) // Show all lines in taskarray (recursive function to go down on tree)
$j = 0; $level = 0; $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), $arrayfields, $arrayofselected); $nboftaskshown = projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, '', ($object->usage_bill_time ? 1 : 0), $arrayfields, $arrayofselected);
} else { } else {
$colspan = count($arrayfields); $colspan = count($arrayfields);
if ($object->usage_bill_time) { if ($object->usage_bill_time) {

View File

@@ -114,8 +114,10 @@ class Stripe extends CommonObject
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$tokenstring = $obj->tokenstring; $tokenstring = $obj->tokenstring;
$tmparray = json_decode($tokenstring); if ($tokenstring) {
$key = empty($tmparray->stripe_user_id) ? '' : $tmparray->stripe_user_id; $tmparray = json_decode($tokenstring);
$key = empty($tmparray->stripe_user_id) ? '' : $tmparray->stripe_user_id;
}
} else { } else {
$tokenstring = ''; $tokenstring = '';
} }
@@ -124,6 +126,7 @@ class Stripe extends CommonObject
} }
dol_syslog("No dedicated Stripe Connect account available for entity ".$conf->entity); dol_syslog("No dedicated Stripe Connect account available for entity ".$conf->entity);
return $key; return $key;
} }