mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
f0ffe83fe6
|
|
@ -795,7 +795,11 @@ if ($nblines != 0) {
|
|||
if ($phan_nblines != 0) {
|
||||
$datatable_script .= '
|
||||
if (typeof(DataTable)==="function") {jQuery(".sourcephan").toggle(true);}
|
||||
let phantable = new DataTable("#technicaldebtphan table");
|
||||
let phantable = new DataTable("#technicaldebtphan table", {
|
||||
lengthMenu: [
|
||||
[10, 25, 50, 100, -1],
|
||||
[10, 25, 50, 100, \'All\']
|
||||
]});
|
||||
';
|
||||
$html .= '<section class="chapter" id="technicaldebtphan">'."\n";
|
||||
$html .= '<h2><span class="fas fa-book-dead pictofixedwidth"></span>Technical debt <span class="opacitymedium">(PHAN '.$phan_nblines.' warnings)</span></h2>'."\n";
|
||||
|
|
@ -806,7 +810,8 @@ if ($phan_nblines != 0) {
|
|||
$html .= '<thead><tr class="trgroup"><td>File</td><td>Line</td><td>Detail</td></tr></thead><tbody>'."\n";
|
||||
$html .= implode("\n", $phan_items);
|
||||
$html .= '</tbody></table>';
|
||||
$html .= '<div><span class="seedetail" data-source="phan" id="sourcephan">Show all...</span></div>';
|
||||
// Disabled, no more required as list is managed with datatable
|
||||
//$html .= '<div><span class="seedetail" data-source="phan" id="sourcephan">Show all...</span></div>';
|
||||
$html .= '</div></div>';
|
||||
|
||||
$html .= '</section>'."\n";
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ class Localtax extends CommonObject
|
|||
|
||||
$this->id = 0;
|
||||
|
||||
$this->tms = '';
|
||||
$this->tms = dol_now();
|
||||
$this->ltt = 0;
|
||||
$this->datep = '';
|
||||
$this->datev = '';
|
||||
|
|
|
|||
|
|
@ -536,7 +536,7 @@ class PaymentVAT extends CommonObject
|
|||
{
|
||||
$this->id = 0;
|
||||
$this->fk_tva = 0;
|
||||
$this->datec = '';
|
||||
$this->datec = dol_now();
|
||||
$this->tms = '';
|
||||
$this->datep = '';
|
||||
$this->amount = '';
|
||||
|
|
|
|||
|
|
@ -419,7 +419,7 @@ class Tva extends CommonObject
|
|||
{
|
||||
$this->id = 0;
|
||||
|
||||
$this->tms = '';
|
||||
$this->tms = dol_now();
|
||||
$this->datep = '';
|
||||
$this->datev = '';
|
||||
$this->amount = '';
|
||||
|
|
|
|||
|
|
@ -911,10 +911,10 @@ abstract class CommonObject
|
|||
}
|
||||
$labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]);
|
||||
if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') {
|
||||
$data[$key]= '<br><b><u>'. $labelextra . '</u></b>';
|
||||
$data[$key] = '<br><b><u>'. $labelextra . '</u></b>';
|
||||
} else {
|
||||
$value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]);
|
||||
$data[$key]= '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element);
|
||||
$data[$key] = '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element);
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
|
@ -957,7 +957,7 @@ abstract class CommonObject
|
|||
{
|
||||
global $hookmanager;
|
||||
|
||||
$parameters = array('objref'=>$objref);
|
||||
$parameters = array('objref' => $objref);
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('getFormatedCustomerRef', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook > 0) {
|
||||
|
|
@ -976,7 +976,7 @@ abstract class CommonObject
|
|||
{
|
||||
global $hookmanager;
|
||||
|
||||
$parameters = array('objref'=>$objref);
|
||||
$parameters = array('objref' => $objref);
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('getFormatedSupplierRef', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook > 0) {
|
||||
|
|
@ -1441,8 +1441,8 @@ abstract class CommonObject
|
|||
'civility' => $obj->civility,
|
||||
'lastname' => $obj->lastname,
|
||||
'firstname' => $obj->firstname,
|
||||
'email'=>$obj->email,
|
||||
'login'=> (empty($obj->login) ? '' : $obj->login),
|
||||
'email' => $obj->email,
|
||||
'login' => (empty($obj->login) ? '' : $obj->login),
|
||||
'photo' => (empty($obj->photo) ? '' : $obj->photo),
|
||||
'statuscontact' => $obj->statuscontact,
|
||||
'rowid' => $obj->rowid,
|
||||
|
|
@ -1769,8 +1769,8 @@ abstract class CommonObject
|
|||
if ($idtofetch) {
|
||||
$thirdparty = new Societe($this->db);
|
||||
$result = $thirdparty->fetch($idtofetch);
|
||||
if ($result<0) {
|
||||
$this->errors=array_merge($this->errors, $thirdparty->errors);
|
||||
if ($result < 0) {
|
||||
$this->errors = array_merge($this->errors, $thirdparty->errors);
|
||||
}
|
||||
$this->thirdparty = $thirdparty;
|
||||
|
||||
|
|
@ -2980,7 +2980,7 @@ abstract class CommonObject
|
|||
} else {
|
||||
if (!$notrigger) {
|
||||
// Call trigger
|
||||
$this->context = array('shippingmethodupdate'=>1);
|
||||
$this->context = array('shippingmethodupdate' => 1);
|
||||
$result = $this->call_trigger(strtoupper(get_class($this)).'_MODIFY', $userused);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
|
|
@ -3320,8 +3320,8 @@ abstract class CommonObject
|
|||
dol_print_error($this->db);
|
||||
return -1;
|
||||
} else {
|
||||
$parameters=array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition);
|
||||
$action='';
|
||||
$parameters = array('rowid' => $rowid, 'rang' => $rang, 'fieldposition' => $fieldposition);
|
||||
$action = '';
|
||||
$reshook = $hookmanager->executeHooks('afterRankOfLineUpdate', $parameters, $this, $action);
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -3965,7 +3965,7 @@ abstract class CommonObject
|
|||
// Add module part to target type if object has $module property and isn't in core modules.
|
||||
$targettype = ((!empty($this->module) && ! in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element;
|
||||
|
||||
$parameters = array('targettype'=>$targettype);
|
||||
$parameters = array('targettype' => $targettype);
|
||||
// Hook for explicitly set the targettype if it must be differtent than $this->element
|
||||
$reshook = $hookmanager->executeHooks('setLinkedObjectSourceTargetType', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook > 0) {
|
||||
|
|
@ -4056,7 +4056,7 @@ abstract class CommonObject
|
|||
$withtargettype = false;
|
||||
$withsourcetype = false;
|
||||
|
||||
$parameters = array('sourcetype'=>$sourcetype, 'sourceid'=>$sourceid, 'targettype'=>$targettype, 'targetid'=>$targetid);
|
||||
$parameters = array('sourcetype' => $sourcetype, 'sourceid' => $sourceid, 'targettype' => $targettype, 'targetid' => $targetid);
|
||||
// Hook for explicitly set the targettype if it must be differtent than $this->element
|
||||
$reshook = $hookmanager->executeHooks('setLinkedObjectSourceTargetType', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook > 0) {
|
||||
|
|
@ -4750,26 +4750,26 @@ abstract class CommonObject
|
|||
//print $id.'-'.$table.'-'.$elementname.'<br>';
|
||||
// Check if element can be deleted
|
||||
$sql = "SELECT COUNT(*) as nb";
|
||||
$sql.= " FROM ".$this->db->prefix().$table." as c";
|
||||
$sql .= " FROM ".$this->db->prefix().$table." as c";
|
||||
if (!empty($element['parent']) && !empty($element['parentkey'])) {
|
||||
$sql.= ", ".$this->db->prefix().$element['parent']." as p";
|
||||
$sql .= ", ".$this->db->prefix().$element['parent']." as p";
|
||||
}
|
||||
if (!empty($element['fk_element'])) {
|
||||
$sql.= " WHERE c.".$element['fk_element']." = ".((int) $id);
|
||||
$sql .= " WHERE c.".$element['fk_element']." = ".((int) $id);
|
||||
} else {
|
||||
$sql.= " WHERE c.".$this->fk_element." = ".((int) $id);
|
||||
$sql .= " WHERE c.".$this->fk_element." = ".((int) $id);
|
||||
}
|
||||
if (!empty($element['parent']) && !empty($element['parentkey'])) {
|
||||
$sql.= " AND c.".$element['parentkey']." = p.rowid";
|
||||
$sql .= " AND c.".$element['parentkey']." = p.rowid";
|
||||
}
|
||||
if (!empty($element['parent']) && !empty($element['parenttypefield']) && !empty($element['parenttypevalue'])) {
|
||||
$sql.= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'";
|
||||
$sql .= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'";
|
||||
}
|
||||
if (!empty($entity)) {
|
||||
if (!empty($element['parent']) && !empty($element['parentkey'])) {
|
||||
$sql.= " AND p.entity = ".((int) $entity);
|
||||
$sql .= " AND p.entity = ".((int) $entity);
|
||||
} else {
|
||||
$sql.= " AND c.entity = ".((int) $entity);
|
||||
$sql .= " AND c.entity = ".((int) $entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4973,7 +4973,7 @@ abstract class CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
return array('weight'=>$totalWeight, 'volume'=>$totalVolume, 'ordered'=>$totalOrdered, 'toship'=>$totalToShip);
|
||||
return array('weight' => $totalWeight, 'volume' => $totalVolume, 'ordered' => $totalOrdered, 'toship' => $totalToShip);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -5093,7 +5093,7 @@ abstract class CommonObject
|
|||
}
|
||||
$extrafields->fetch_name_optionals_label($this->table_element_line);
|
||||
|
||||
$parameters = array('num'=>$num, 'dateSelector'=>$dateSelector, 'seller'=>$seller, 'buyer'=>$buyer, 'selected'=>$selected, 'table_element_line'=>$this->table_element_line);
|
||||
$parameters = array('num' => $num, 'dateSelector' => $dateSelector, 'seller' => $seller, 'buyer' => $buyer, 'selected' => $selected, 'table_element_line' => $this->table_element_line);
|
||||
$reshook = $hookmanager->executeHooks('printObjectLineTitle', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if (empty($reshook)) {
|
||||
// Output template part (modules that overwrite templates must declare this into descriptor)
|
||||
|
|
@ -5130,10 +5130,10 @@ abstract class CommonObject
|
|||
//if (is_object($hookmanager) && (($line->product_type == 9 && !empty($line->special_code)) || !empty($line->fk_parent_line)))
|
||||
if (is_object($hookmanager)) { // Old code is commented on preceding line.
|
||||
if (empty($line->fk_parent_line)) {
|
||||
$parameters = array('line'=>$line, 'num'=>$num, 'i'=>$i, 'dateSelector'=>$dateSelector, 'seller'=>$seller, 'buyer'=>$buyer, 'selected'=>$selected, 'table_element_line'=>$line->table_element, 'defaulttpldir'=>$defaulttpldir);
|
||||
$parameters = array('line' => $line, 'num' => $num, 'i' => $i, 'dateSelector' => $dateSelector, 'seller' => $seller, 'buyer' => $buyer, 'selected' => $selected, 'table_element_line' => $line->table_element, 'defaulttpldir' => $defaulttpldir);
|
||||
$reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
} else {
|
||||
$parameters = array('line'=>$line, 'num'=>$num, 'i'=>$i, 'dateSelector'=>$dateSelector, 'seller'=>$seller, 'buyer'=>$buyer, 'selected'=>$selected, 'table_element_line'=>$line->table_element, 'fk_parent_line'=>$line->fk_parent_line, 'defaulttpldir'=>$defaulttpldir);
|
||||
$parameters = array('line' => $line, 'num' => $num, 'i' => $i, 'dateSelector' => $dateSelector, 'seller' => $seller, 'buyer' => $buyer, 'selected' => $selected, 'table_element_line' => $line->table_element, 'fk_parent_line' => $line->fk_parent_line, 'defaulttpldir' => $defaulttpldir);
|
||||
$reshook = $hookmanager->executeHooks('printObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
}
|
||||
}
|
||||
|
|
@ -5316,7 +5316,7 @@ abstract class CommonObject
|
|||
$reshook = 0;
|
||||
//if (is_object($hookmanager) && (($line->product_type == 9 && !empty($line->special_code)) || !empty($line->fk_parent_line))) {
|
||||
if (is_object($hookmanager)) { // Old code is commented on preceding line.
|
||||
$parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines);
|
||||
$parameters = array('line' => $line, 'i' => $i, 'restrictlist' => $restrictlist, 'selectedLines' => $selectedLines);
|
||||
if (!empty($line->fk_parent_line)) {
|
||||
$parameters['fk_parent_line'] = $line->fk_parent_line;
|
||||
}
|
||||
|
|
@ -5597,7 +5597,7 @@ abstract class CommonObject
|
|||
|
||||
$srctemplatepath = '';
|
||||
|
||||
$parameters = array('modelspath'=>$modelspath, 'modele'=>$modele, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'hidedesc'=>$hidedesc, 'hideref'=>$hideref, 'moreparams'=>$moreparams);
|
||||
$parameters = array('modelspath' => $modelspath, 'modele' => $modele, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'hidedesc' => $hidedesc, 'hideref' => $hideref, 'moreparams' => $moreparams);
|
||||
$reshook = $hookmanager->executeHooks('commonGenerateDocument', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (!empty($reshook)) {
|
||||
|
|
@ -6332,7 +6332,7 @@ abstract class CommonObject
|
|||
return 0;
|
||||
}
|
||||
} else {
|
||||
$this->errors[]=$this->db->lasterror;
|
||||
$this->errors[] = $this->db->lasterror;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -6653,7 +6653,7 @@ abstract class CommonObject
|
|||
|
||||
if (!$error && $trigger) {
|
||||
// Call trigger
|
||||
$this->context = array('extrafieldaddupdate'=>1);
|
||||
$this->context = array('extrafieldaddupdate' => 1);
|
||||
$result = $this->call_trigger($trigger, $userused);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
|
|
@ -6771,7 +6771,7 @@ abstract class CommonObject
|
|||
|
||||
if (!$error && $trigger) {
|
||||
// Call trigger
|
||||
$this->context = array('extralanguagesaddupdate'=>1);
|
||||
$this->context = array('extralanguagesaddupdate' => 1);
|
||||
$result = $this->call_trigger($trigger, $userused);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
|
|
@ -7066,7 +7066,7 @@ abstract class CommonObject
|
|||
|
||||
if (!$error && $trigger) {
|
||||
// Call trigger
|
||||
$this->context = array('extrafieldupdate'=>1);
|
||||
$this->context = array('extrafieldupdate' => 1);
|
||||
$result = $this->call_trigger($trigger, $userused);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
|
|
@ -7197,7 +7197,7 @@ abstract class CommonObject
|
|||
// Special case that force options and type ($type can be integer, varchar, ...)
|
||||
if (!empty($this->fields[$key]['arrayofkeyval']) && is_array($this->fields[$key]['arrayofkeyval'])) {
|
||||
$param['options'] = $this->fields[$key]['arrayofkeyval'];
|
||||
$type = (($this->fields[$key]['type']=='checkbox') ? $this->fields[$key]['type'] : 'select');
|
||||
$type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select');
|
||||
}
|
||||
|
||||
$label = $this->fields[$key]['label'];
|
||||
|
|
@ -7249,7 +7249,7 @@ abstract class CommonObject
|
|||
|
||||
// Add validation state class
|
||||
if (!empty($validationClass)) {
|
||||
$morecss.= $validationClass;
|
||||
$morecss .= $validationClass;
|
||||
}
|
||||
|
||||
if (in_array($type, array('date'))) {
|
||||
|
|
@ -7375,7 +7375,7 @@ abstract class CommonObject
|
|||
$pos++;
|
||||
}
|
||||
$tmpbefore = substr($InfoFieldList[4], 0, $pos);
|
||||
$tmpafter = substr($InfoFieldList[4], $pos+1);
|
||||
$tmpafter = substr($InfoFieldList[4], $pos + 1);
|
||||
//var_dump($InfoFieldList[4].' -> '.$pos); var_dump($tmpafter);
|
||||
$InfoFieldList[4] = $tmpbefore;
|
||||
if ($tmpafter !== '') {
|
||||
|
|
@ -7796,7 +7796,7 @@ abstract class CommonObject
|
|||
$out = '<input type="hidden" value="'.$value.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"/>';
|
||||
}
|
||||
|
||||
if ($isDependList==1) {
|
||||
if ($isDependList == 1) {
|
||||
$out .= $this->getJSListDependancies('_common');
|
||||
}
|
||||
/* Add comments
|
||||
|
|
@ -7847,7 +7847,7 @@ abstract class CommonObject
|
|||
$type = 'varchar'; // convert varchar(xx) int varchar
|
||||
}
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||
$type = (($this->fields[$key]['type']=='checkbox') ? $this->fields[$key]['type'] : 'select');
|
||||
$type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select');
|
||||
}
|
||||
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) {
|
||||
$type = 'link';
|
||||
|
|
@ -8359,7 +8359,7 @@ abstract class CommonObject
|
|||
|
||||
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) {
|
||||
$type = 'link';
|
||||
$param['options'] = array($reg[1].':'.$reg[2]=>$reg[1].':'.$reg[2]);
|
||||
$param['options'] = array($reg[1].':'.$reg[2] => $reg[1].':'.$reg[2]);
|
||||
} elseif (preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)) {
|
||||
$param['options'] = array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4] => 'N');
|
||||
$type = 'sellist';
|
||||
|
|
@ -8529,7 +8529,7 @@ abstract class CommonObject
|
|||
|
||||
$out = '';
|
||||
|
||||
$parameters = array('mode'=>$mode, 'params'=>$params, 'keysuffix'=>$keysuffix, 'keyprefix'=>$keyprefix, 'display_type'=>$display_type);
|
||||
$parameters = array('mode' => $mode, 'params' => $params, 'keysuffix' => $keysuffix, 'keyprefix' => $keyprefix, 'display_type' => $display_type);
|
||||
$reshook = $hookmanager->executeHooks('showOptionals', $parameters, $this, $action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
if (empty($reshook)) {
|
||||
|
|
@ -8590,7 +8590,7 @@ abstract class CommonObject
|
|||
}
|
||||
|
||||
$colspan = 0;
|
||||
if (is_array($params) && count($params) > 0 && $display_type=='card') {
|
||||
if (is_array($params) && count($params) > 0 && $display_type == 'card') {
|
||||
if (array_key_exists('cols', $params)) {
|
||||
$colspan = $params['cols'];
|
||||
} elseif (array_key_exists('colspan', $params)) { // For backward compatibility. Use cols instead now.
|
||||
|
|
@ -8677,7 +8677,7 @@ abstract class CommonObject
|
|||
$domData .= ' data-targetid="'.$this->id.'"';
|
||||
|
||||
$html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id);
|
||||
if ($display_type=='card') {
|
||||
if ($display_type == 'card') {
|
||||
if (getDolGlobalString('MAIN_EXTRAFIELDS_USE_TWO_COLUMS') && ($e % 2) == 0) {
|
||||
$colspan = 0;
|
||||
}
|
||||
|
|
@ -8788,12 +8788,12 @@ abstract class CommonObject
|
|||
break;
|
||||
}
|
||||
|
||||
$out .= ($display_type=='card' ? '</td>' : '</div>');
|
||||
$out .= ($display_type == 'card' ? '</td>' : '</div>');
|
||||
|
||||
if (getDolGlobalString('MAIN_EXTRAFIELDS_USE_TWO_COLUMS') && (($e % 2) == 1)) {
|
||||
$out .= ($display_type=='card' ? '</tr>' : '</div>');
|
||||
$out .= ($display_type == 'card' ? '</tr>' : '</div>');
|
||||
} else {
|
||||
$out .= ($display_type=='card' ? '</tr>' : '</div>');
|
||||
$out .= ($display_type == 'card' ? '</tr>' : '</div>');
|
||||
}
|
||||
|
||||
$e++;
|
||||
|
|
@ -10572,7 +10572,7 @@ abstract class CommonObject
|
|||
// Process
|
||||
foreach ($to_del as $del) {
|
||||
if ($c->fetch($del) > 0) {
|
||||
$result=$c->del_type($this, $type_categ);
|
||||
$result = $c->del_type($this, $type_categ);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->error = $c->error;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.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
|
||||
|
|
|
|||
|
|
@ -700,7 +700,7 @@ class DolGraph
|
|||
}
|
||||
|
||||
//print "max=".$max." res=".$res;
|
||||
return $res;
|
||||
return (int) $res;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
|
|
@ -1540,7 +1540,7 @@ class DolGraph
|
|||
/**
|
||||
* Output HTML string to total value
|
||||
*
|
||||
* @return string HTML string to total value
|
||||
* @return float|int HTML string to total value
|
||||
*/
|
||||
public function total()
|
||||
{
|
||||
|
|
@ -1587,16 +1587,16 @@ class DolGraph
|
|||
public static function getDefaultGraphSizeForStats($direction, $defaultsize = '')
|
||||
{
|
||||
global $conf;
|
||||
$defaultsize = (int) $defaultsize;
|
||||
|
||||
if ($direction == 'width') {
|
||||
if (empty($conf->dol_optimize_smallscreen)) {
|
||||
return ($defaultsize ? $defaultsize : '500');
|
||||
return ($defaultsize ? $defaultsize : 500);
|
||||
} else {
|
||||
return (empty($_SESSION['dol_screenwidth']) ? '280' : ($_SESSION['dol_screenwidth'] - 40));
|
||||
return (empty($_SESSION['dol_screenwidth']) ? 280 : ($_SESSION['dol_screenwidth'] - 40));
|
||||
}
|
||||
}
|
||||
if ($direction == 'height') {
|
||||
return (empty($conf->dol_optimize_smallscreen) ? ($defaultsize ? $defaultsize : '220') : '200');
|
||||
} elseif ($direction == 'height') {
|
||||
return (empty($conf->dol_optimize_smallscreen) ? ($defaultsize ? $defaultsize : 220) : 200);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
|
||||
/**
|
||||
* Class to manage HTML output components for orders
|
||||
|
|
@ -68,7 +69,43 @@ class FormOrder extends Form
|
|||
$selectedarray = explode(',', $selected);
|
||||
}
|
||||
|
||||
print Form::multiselectarray($hmlname, $options, $selectedarray, 0, 0, $morecss);
|
||||
print Form::multiselectarray($hmlname, $options, $selectedarray, 0, 0, $morecss, 0, 150);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return combo list of different status of orders
|
||||
*
|
||||
* @param string $selected Preselected value
|
||||
* @param int $short Use short labels
|
||||
* @param string $hmlname Name of HTML select element
|
||||
* @return void
|
||||
*/
|
||||
public function selectOrderStatus($selected = '', $short = 0, $hmlname = 'order_status')
|
||||
{
|
||||
$options = array();
|
||||
|
||||
$statustohow = array(
|
||||
Commande::STATUS_DRAFT,
|
||||
Commande::STATUS_VALIDATED,
|
||||
Commande::STATUS_SHIPMENTONPROCESS,
|
||||
Commande::STATUS_CLOSED,
|
||||
Commande::STATUS_CANCELED
|
||||
);
|
||||
|
||||
$tmpsupplierorder = new Commande($this->db);
|
||||
|
||||
foreach ($statustohow as $value) {
|
||||
$tmpsupplierorder->statut = $value;
|
||||
$options[$value] = $tmpsupplierorder->getLibStatut($short);
|
||||
}
|
||||
|
||||
if (is_array($selected)) {
|
||||
$selectedarray = $selected;
|
||||
} else {
|
||||
$selectedarray = explode(',', $selected);
|
||||
}
|
||||
|
||||
print Form::multiselectarray($hmlname, $options, $selectedarray, 0, 0, '', 0, 150);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ function dol_basename($pathfile)
|
|||
* Scan a directory and return a list of files/directories.
|
||||
* Content for string is UTF8 and dir separator is "/".
|
||||
*
|
||||
* @param string $path Starting path from which to search. This is a full path.
|
||||
* @param string $utf8_path Starting path from which to search. This is a full path.
|
||||
* @param string $types Can be "directories", "files", or "all"
|
||||
* @param int $recursive Determines whether subdirectories are searched
|
||||
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/' by doing preg_quote($var,'/'), since this char is used for preg_match function,
|
||||
|
|
@ -60,7 +60,7 @@ function dol_basename($pathfile)
|
|||
* @return array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string}> Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file',...)
|
||||
* @see dol_dir_list_in_database()
|
||||
*/
|
||||
function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excludefilter = null, $sortcriteria = "name", $sortorder = SORT_ASC, $mode = 0, $nohook = 0, $relativename = "", $donotfollowsymlinks = 0, $nbsecondsold = 0)
|
||||
function dol_dir_list($utf8_path, $types = "all", $recursive = 0, $filter = "", $excludefilter = null, $sortcriteria = "name", $sortorder = SORT_ASC, $mode = 0, $nohook = 0, $relativename = "", $donotfollowsymlinks = 0, $nbsecondsold = 0)
|
||||
{
|
||||
global $db, $hookmanager;
|
||||
global $object;
|
||||
|
|
@ -79,8 +79,8 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
|
|||
dol_syslog("'$f' has unescaped '/'", LOG_ERR);
|
||||
}
|
||||
}
|
||||
dol_syslog("files.lib.php::dol_dir_list path=".$path." types=".$types." recursive=".$recursive." filter=".$filter." excludefilter=".json_encode($excludefilter).$error_info);
|
||||
//print 'xxx'."files.lib.php::dol_dir_list path=".$path." types=".$types." recursive=".$recursive." filter=".$filter." excludefilter=".json_encode($excludefilter);
|
||||
dol_syslog("files.lib.php::dol_dir_list path=".$utf8_path." types=".$types." recursive=".$recursive." filter=".$filter." excludefilter=".json_encode($excludefilter).$error_info);
|
||||
//print 'xxx'."files.lib.php::dol_dir_list path=".$utf8_path." types=".$types." recursive=".$recursive." filter=".$filter." excludefilter=".json_encode($excludefilter);
|
||||
if (!$filters_ok) {
|
||||
// Return empty array when filters are invalid
|
||||
return array();
|
||||
|
|
@ -92,8 +92,8 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
|
|||
$loadperm = ($mode == 1 || $mode == 4);
|
||||
|
||||
// Clean parameters
|
||||
$path = preg_replace('/([\\/]+)$/', '', $path);
|
||||
$newpath = dol_osencode($path);
|
||||
$utf8_path = preg_replace('/([\\/]+)$/', '', $utf8_path);
|
||||
$os_path = dol_osencode($utf8_path);
|
||||
$now = dol_now();
|
||||
|
||||
$reshook = 0;
|
||||
|
|
@ -105,7 +105,7 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
|
|||
$hookmanager->initHooks(array('fileslib'));
|
||||
|
||||
$parameters = array(
|
||||
'path' => $newpath,
|
||||
'path' => $os_path,
|
||||
'types' => $types,
|
||||
'recursive' => $recursive,
|
||||
'filter' => $filter,
|
||||
|
|
@ -121,24 +121,28 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
|
|||
|
||||
// $hookmanager->resArray may contain array stacked by other modules
|
||||
if (empty($reshook)) {
|
||||
if (!is_dir($newpath)) {
|
||||
if (!is_dir($os_path)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
if (($dir = opendir($newpath)) === false) {
|
||||
if (($dir = opendir($os_path)) === false) {
|
||||
return array();
|
||||
} else {
|
||||
$filedate = '';
|
||||
$filesize = '';
|
||||
$fileperm = '';
|
||||
while (false !== ($file = readdir($dir))) { // $file is always a basename (into directory $newpath)
|
||||
if (!utf8_check($file)) {
|
||||
$file = mb_convert_encoding($file, 'UTF-8', 'ISO-8859-1'); // To be sure data is stored in utf8 in memory
|
||||
while (false !== ($os_file = readdir($dir))) { // $utf8_file is always a basename (in directory $os_path)
|
||||
$os_fullpathfile = ($os_path ? $os_path.'/' : '').$os_file;
|
||||
|
||||
if (!utf8_check($os_file)) {
|
||||
$utf8_file = mb_convert_encoding($os_file, 'UTF-8', 'ISO-8859-1'); // Make sure data is stored in utf8 in memory
|
||||
} else {
|
||||
$utf8_file = $os_file;
|
||||
}
|
||||
$fullpathfile = ($newpath ? $newpath.'/' : '').$file;
|
||||
|
||||
$qualified = 1;
|
||||
|
||||
$utf8_fullpathfile = "$utf8_path/$utf8_file"; // Temp variable for speed
|
||||
// Define excludefilterarray
|
||||
$excludefilterarray = array('^\.');
|
||||
if (is_array($excludefilter)) {
|
||||
|
|
@ -148,39 +152,39 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
|
|||
}
|
||||
// Check if file is qualified
|
||||
foreach ($excludefilterarray as $filt) {
|
||||
if (preg_match('/'.$filt.'/i', $file) || preg_match('/'.$filt.'/i', $fullpathfile)) {
|
||||
if (preg_match('/'.$filt.'/i', $utf8_file) || preg_match('/'.$filt.'/i', $utf8_fullpathfile)) {
|
||||
$qualified = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//print $fullpathfile.' '.$file.' '.$qualified.'<br>';
|
||||
//print $utf8_fullpathfile.' '.$utf8_file.' '.$qualified.'<br>';
|
||||
|
||||
if ($qualified) {
|
||||
$isdir = is_dir(dol_osencode($path."/".$file));
|
||||
$isdir = is_dir($os_fullpathfile);
|
||||
// Check whether this is a file or directory and whether we're interested in that type
|
||||
if ($isdir && (($types == "directories") || ($types == "all") || $recursive > 0)) {
|
||||
// Add entry into file_list array
|
||||
if (($types == "directories") || ($types == "all")) {
|
||||
if ($loaddate || $sortcriteria == 'date') {
|
||||
$filedate = dol_filemtime($path."/".$file);
|
||||
$filedate = dol_filemtime($utf8_fullpathfile);
|
||||
}
|
||||
if ($loadsize || $sortcriteria == 'size') {
|
||||
$filesize = dol_filesize($path."/".$file);
|
||||
$filesize = dol_filesize($utf8_fullpathfile);
|
||||
}
|
||||
if ($loadperm || $sortcriteria == 'perm') {
|
||||
$fileperm = dol_fileperm($path."/".$file);
|
||||
$fileperm = dol_fileperm($utf8_fullpathfile);
|
||||
}
|
||||
|
||||
if (!$filter || preg_match('/'.$filter.'/i', $file)) { // We do not search key $filter into all $path, only into $file part
|
||||
if (!$filter || preg_match('/'.$filter.'/i', $utf8_file)) { // We do not search key $filter into all $path, only into $file part
|
||||
$reg = array();
|
||||
preg_match('/([^\/]+)\/[^\/]+$/', $path.'/'.$file, $reg);
|
||||
preg_match('/([^\/]+)\/[^\/]+$/', $utf8_fullpathfile, $reg);
|
||||
$level1name = (isset($reg[1]) ? $reg[1] : '');
|
||||
$file_list[] = array(
|
||||
"name" => $file,
|
||||
"path" => $path,
|
||||
"name" => $utf8_file,
|
||||
"path" => $utf8_path,
|
||||
"level1name" => $level1name,
|
||||
"relativename" => ($relativename ? $relativename.'/' : '').$file,
|
||||
"fullname" => $path.'/'.$file,
|
||||
"relativename" => ($relativename ? $relativename.'/' : '').$utf8_file,
|
||||
"fullname" => $utf8_fullpathfile,
|
||||
"date" => $filedate,
|
||||
"size" => $filesize,
|
||||
"perm" => $fileperm,
|
||||
|
|
@ -191,30 +195,30 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
|
|||
|
||||
// if we're in a directory and we want recursive behavior, call this function again
|
||||
if ($recursive > 0) {
|
||||
if (empty($donotfollowsymlinks) || !is_link($path."/".$file)) {
|
||||
//var_dump('eee '. $path."/".$file. ' '.is_dir($path."/".$file).' '.is_link($path."/".$file));
|
||||
$file_list = array_merge($file_list, dol_dir_list($path."/".$file, $types, $recursive + 1, $filter, $excludefilter, $sortcriteria, $sortorder, $mode, $nohook, ($relativename != '' ? $relativename.'/' : '').$file, $donotfollowsymlinks, $nbsecondsold));
|
||||
if (empty($donotfollowsymlinks) || !is_link($utf8_fullpathfile)) {
|
||||
//var_dump('eee '. $utf8_fullpathfile. ' '.is_dir($utf8_fullpathfile).' '.is_link($utf8_fullpathfile));
|
||||
$file_list = array_merge($file_list, dol_dir_list($utf8_fullpathfile, $types, $recursive + 1, $filter, $excludefilter, $sortcriteria, $sortorder, $mode, $nohook, ($relativename != '' ? $relativename.'/' : '').$utf8_file, $donotfollowsymlinks, $nbsecondsold));
|
||||
}
|
||||
}
|
||||
} elseif (!$isdir && (($types == "files") || ($types == "all"))) {
|
||||
// Add file into file_list array
|
||||
if ($loaddate || $sortcriteria == 'date') {
|
||||
$filedate = dol_filemtime($path."/".$file);
|
||||
$filedate = dol_filemtime($utf8_fullpathfile);
|
||||
}
|
||||
if ($loadsize || $sortcriteria == 'size') {
|
||||
$filesize = dol_filesize($path."/".$file);
|
||||
$filesize = dol_filesize($utf8_fullpathfile);
|
||||
}
|
||||
|
||||
if (!$filter || preg_match('/'.$filter.'/i', $file)) { // We do not search key $filter into $path, only into $file
|
||||
if (!$filter || preg_match('/'.$filter.'/i', $utf8_file)) { // We do not search key $filter into $utf8_path, only into $utf8_file
|
||||
if (empty($nbsecondsold) || $filedate <= ($now - $nbsecondsold)) {
|
||||
preg_match('/([^\/]+)\/[^\/]+$/', $path.'/'.$file, $reg);
|
||||
preg_match('/([^\/]+)\/[^\/]+$/', $utf8_fullpathfile, $reg);
|
||||
$level1name = (isset($reg[1]) ? $reg[1] : '');
|
||||
$file_list[] = array(
|
||||
"name" => $file,
|
||||
"path" => $path,
|
||||
"name" => $utf8_file,
|
||||
"path" => $utf8_path,
|
||||
"level1name" => $level1name,
|
||||
"relativename" => ($relativename ? $relativename.'/' : '').$file,
|
||||
"fullname" => $path.'/'.$file,
|
||||
"relativename" => ($relativename ? $relativename.'/' : '').$utf8_file,
|
||||
"fullname" => $utf8_fullpathfile,
|
||||
"date" => $filedate,
|
||||
"size" => $filesize,
|
||||
"type" => 'file'
|
||||
|
|
@ -233,7 +237,7 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
|
|||
}
|
||||
}
|
||||
|
||||
if (is_object($hookmanager) && is_array($hookmanager->resArray)) {
|
||||
if ($hookmanager instanceof HookManager && is_array($hookmanager->resArray)) {
|
||||
$file_list = array_merge($file_list, $hookmanager->resArray);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4597,7 +4597,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
|||
'graph' => 'chart-line', 'grip_title' => 'arrows-alt', 'grip' => 'arrows-alt', 'help' => 'question-circle',
|
||||
'generic' => 'file', 'holiday' => 'umbrella-beach',
|
||||
'info' => 'info-circle', 'inventory' => 'boxes', 'intracommreport' => 'globe-europe', 'jobprofile' => 'cogs',
|
||||
'knowledgemanagement' => 'ticket-alt', 'label' => 'layer-group', 'layout'=>'columns', 'line' => 'bars', 'loan' => 'money-bill-alt',
|
||||
'knowledgemanagement' => 'ticket-alt', 'label' => 'layer-group', 'layout' => 'columns', 'line' => 'bars', 'loan' => 'money-bill-alt',
|
||||
'member' => 'user-alt', 'meeting' => 'chalkboard-teacher', 'mrp' => 'cubes', 'next' => 'arrow-alt-circle-right',
|
||||
'trip' => 'wallet', 'expensereport' => 'wallet', 'group' => 'users', 'movement' => 'people-carry',
|
||||
'sign-out' => 'sign-out-alt',
|
||||
|
|
|
|||
|
|
@ -133,7 +133,20 @@ class modProjet extends DolibarrModules
|
|||
3=>array('file'=>'box_validated_projects.php', 'enabledbydefaulton'=>'Home'), // task without timespent
|
||||
4=>array('file'=>'box_funnel_of_prospection.php', 'enabledbydefaulton'=>'Home'),
|
||||
);
|
||||
|
||||
// Cronjobs
|
||||
$this->cronjobs[] = array(
|
||||
'label' => 'WeeklyWorkingHoursReport',
|
||||
'jobtype' => 'method',
|
||||
'class' => 'projet/class/project.class.php',
|
||||
'objectname' => 'Project',
|
||||
'method' => 'createWeeklyReport',
|
||||
'parameters' => '',
|
||||
'comment' => 'Generates and sends a weekly report on time worked',
|
||||
'frequency' => 1,
|
||||
'unitfrequency' => 86400 * 7,
|
||||
'status' => 0,
|
||||
'test' => '$conf->projet->enabled',
|
||||
);
|
||||
// Permissions
|
||||
$this->rights = array();
|
||||
$this->rights_class = 'projet';
|
||||
|
|
|
|||
|
|
@ -86,7 +86,9 @@ class pdf_eagle extends ModelePDFStockTransfer
|
|||
public $posxwarehousedestination;
|
||||
|
||||
/**
|
||||
* @var int at Least One Batch
|
||||
* @var bool True if at least one line of the StockTransfer object has a batch set.
|
||||
* Populated by $pdf_eagle->atLeastOneBatch()
|
||||
* @see atLeastOneBatch()
|
||||
*/
|
||||
public $atLeastOneBatch;
|
||||
|
||||
|
|
@ -916,7 +918,7 @@ class pdf_eagle extends ModelePDFStockTransfer
|
|||
*
|
||||
* @param StockTransfer $object Stock Transfer object
|
||||
* @return boolean true if at least one line has batch set, false if not
|
||||
 */
|
||||
*/
|
||||
public function atLeastOneBatch($object)
|
||||
{
|
||||
global $conf;
|
||||
|
|
|
|||
|
|
@ -144,7 +144,9 @@ if ($action == 'add' && $permissiontoadd) {
|
|||
$object->frequency = GETPOSTINT('nbfrequency');
|
||||
$object->maxrun = GETPOSTINT('maxrun');
|
||||
$object->email_alert = GETPOST('email_alert');
|
||||
|
||||
$object->status = 0;
|
||||
$object->processing = 0;
|
||||
$object->lastresult = '';
|
||||
// Add cron task
|
||||
$result = $object->create($user);
|
||||
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ class SupplierInvoices extends DolibarrApi
|
|||
* Add payment line to a specific supplier invoice with the remain to pay as amount.
|
||||
*
|
||||
* @param int $id Id of invoice
|
||||
* @param string $datepaye {@from body} Payment date {@type timestamp}
|
||||
* @param int $datepaye {@from body} Payment date {@type timestamp}
|
||||
* @param int $payment_mode_id {@from body} Payment mode ID (look it up via REST GET to /setup/dictionary/payment_types) {@min 1}
|
||||
* @param string $closepaidinvoices {@from body} Close paid invoices {@choice yes,no}
|
||||
* @param int $accountid {@from body} Bank account ID (look it up via REST GET to /bankaccounts) {@min 1}
|
||||
|
|
@ -461,12 +461,12 @@ class SupplierInvoices extends DolibarrApi
|
|||
$amounts = array();
|
||||
$multicurrency_amounts = array();
|
||||
|
||||
$paymentamount = price2num($paymentamount, 'MT');
|
||||
$paymentamount = (float) price2num($paymentamount, 'MT');
|
||||
|
||||
$amounts[$id] = $paymentamount;
|
||||
|
||||
// Multicurrency
|
||||
$newvalue = price2num($this->invoice->multicurrency_total_ttc, 'MT');
|
||||
$newvalue = (float) price2num($this->invoice->multicurrency_total_ttc, 'MT');
|
||||
$multicurrency_amounts[$id] = $newvalue;
|
||||
|
||||
// Creation of payment line
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2023 Alexandre Janniaux <alexandre.janniaux@gmail.com>
|
||||
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2023 Alexandre Janniaux <alexandre.janniaux@gmail.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -81,7 +82,7 @@ class MyObjectTest extends PHPUnit\Framework\TestCase
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
global $conf, $user, $langs, $db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
|
@ -94,7 +95,7 @@ class MyObjectTest extends PHPUnit\Framework\TestCase
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
global $conf, $user, $langs, $db;
|
||||
$conf = $this->savconf;
|
||||
|
|
@ -110,7 +111,7 @@ class MyObjectTest extends PHPUnit\Framework\TestCase
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
protected function tearDown(): void
|
||||
{
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
|
@ -120,7 +121,7 @@ class MyObjectTest extends PHPUnit\Framework\TestCase
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function tearDownAfterClass()
|
||||
public static function tearDownAfterClass(): void
|
||||
{
|
||||
global $conf, $user, $langs, $db;
|
||||
$db->rollback();
|
||||
|
|
|
|||
|
|
@ -310,13 +310,13 @@ class Propalmergepdfproduct extends CommonObject
|
|||
// Clean parameters
|
||||
|
||||
if (isset($this->fk_product)) {
|
||||
$this->fk_product = trim($this->fk_product);
|
||||
$this->fk_product = (int) $this->fk_product;
|
||||
}
|
||||
if (isset($this->file_name)) {
|
||||
$this->file_name = trim($this->file_name);
|
||||
}
|
||||
if (isset($this->fk_user_mod)) {
|
||||
$this->fk_user_mod = trim($this->fk_user_mod);
|
||||
$this->fk_user_mod = (int) $this->fk_user_mod;
|
||||
}
|
||||
if (isset($this->lang)) {
|
||||
$this->lang = trim($this->lang);
|
||||
|
|
|
|||
|
|
@ -48,16 +48,16 @@ if (isModEnabled('barcode')) {
|
|||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('products', 'suppliers', 'bills', 'margins', 'stocks'));
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$id = GETPOSTINT('id');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$rowid = GETPOSTINT('rowid');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'pricesuppliercard';
|
||||
|
||||
$socid = GETPOST('socid', 'int');
|
||||
$cost_price = price2num(GETPOST('cost_price', 'alpha'), '', 2);
|
||||
$pmp = price2num(GETPOST('pmp', 'alpha'), '', 2);
|
||||
$socid = GETPOSTINT('socid');
|
||||
$cost_price = GETPOSTFLOAT('cost_price');
|
||||
$pmp = GETPOSTFLOAT('pmp');
|
||||
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$error = 0;
|
||||
|
|
@ -65,9 +65,9 @@ $error = 0;
|
|||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// If socid provided by ajax company selector
|
||||
if (GETPOST('search_fourn_id', 'int')) {
|
||||
$_GET['id_fourn'] = GETPOST('search_fourn_id', 'int');
|
||||
$_POST['id_fourn'] = GETPOST('search_fourn_id', 'int');
|
||||
if (GETPOSTINT('search_fourn_id')) {
|
||||
$_GET['id_fourn'] = GETPOSTINT('search_fourn_id');
|
||||
$_POST['id_fourn'] = GETPOSTINT('search_fourn_id');
|
||||
}
|
||||
|
||||
// Security check
|
||||
|
|
@ -81,10 +81,10 @@ if (!$user->hasRight('fournisseur', 'lire') && (!isModEnabled('margin') && !$use
|
|||
accessforbidden();
|
||||
}
|
||||
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = (GETPOST("page", 'int') ? GETPOST("page", 'int') : 0);
|
||||
$page = GETPOSTINT("page") ? GETPOSTINT("page") : 0;
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
|
|
@ -143,7 +143,7 @@ if (empty($reshook)) {
|
|||
$result = $object->fetch($id);
|
||||
//Need dol_clone methode 1 (same object class) because update product use hasbatch method on oldcopy
|
||||
$object->oldcopy = dol_clone($object, 1);
|
||||
$object->cost_price = price2num($cost_price);
|
||||
$object->cost_price = $cost_price;
|
||||
$result = $object->update($object->id, $user);
|
||||
if ($result > 0) {
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
|
|
@ -157,7 +157,7 @@ if (empty($reshook)) {
|
|||
if ($action == 'setpmp') {
|
||||
if ($id) {
|
||||
$result = $object->fetch($id);
|
||||
$object->pmp = price2num($pmp);
|
||||
$object->pmp = $pmp;
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product SET pmp = ".((float) $object->pmp)." WHERE rowid = ".((int) $id);
|
||||
$resql = $db->query($sql);
|
||||
//$result = $object->update($object->id, $user);
|
||||
|
|
@ -297,7 +297,7 @@ if (empty($reshook)) {
|
|||
$extralabels = $extrafields->fetch_name_optionals_label("product_fournisseur_price");
|
||||
$extrafield_values = $extrafields->getOptionalsFromPost("product_fournisseur_price");
|
||||
|
||||
$newprice = price2num(GETPOST("price", "alpha"));
|
||||
$newprice = GETPOSTFLOAT("price");
|
||||
|
||||
if (empty($packaging)) {
|
||||
$packaging = 1;
|
||||
|
|
@ -309,8 +309,8 @@ if (empty($reshook)) {
|
|||
$object->packaging = $packaging;
|
||||
|
||||
if (isModEnabled("multicurrency")) {
|
||||
$multicurrency_tx = price2num(GETPOST("multicurrency_tx", 'alpha'));
|
||||
$multicurrency_price = price2num(GETPOST("multicurrency_price", 'alpha'));
|
||||
$multicurrency_tx = GETPOSTFLOAT("multicurrency_tx");
|
||||
$multicurrency_price = GETPOSTFLOAT("multicurrency_price");
|
||||
$multicurrency_code = GETPOST("multicurrency_code", 'alpha');
|
||||
|
||||
$ret = $object->update_buyprice($quantity, $newprice, $user, GETPOST("price_base_type"), $supplier, GETPOST("oselDispo"), $ref_fourn, $tva_tx, GETPOST("charges"), $remise_percent, 0, $npr, $delivery_time_days, $supplier_reputation, array(), '', $multicurrency_price, GETPOST("multicurrency_price_base_type"), $multicurrency_tx, $multicurrency_code, $supplier_description, $barcode, $fk_barcode_type, $extrafield_values);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('orders', 'products', 'companies'));
|
||||
|
|
@ -67,10 +68,16 @@ if (!$sortfield) {
|
|||
}
|
||||
$search_month = GETPOST('search_month', 'int');
|
||||
$search_year = GETPOST('search_year', 'int');
|
||||
if (GETPOSTISARRAY('search_status')) {
|
||||
$search_status = join(',', GETPOST('search_status', 'array:intcomma'));
|
||||
} else {
|
||||
$search_status = (GETPOST('search_status', 'intcomma') != '' ? GETPOST('search_status', 'intcomma') : GETPOST('statut', 'intcomma'));
|
||||
}
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
$search_month = '';
|
||||
$search_year = '';
|
||||
$search_status = '';
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
|
||||
|
|
@ -85,6 +92,7 @@ $societestatic = new Societe($db);
|
|||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formorder = new FormOrder($db);
|
||||
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$product = new Product($db);
|
||||
|
|
@ -155,10 +163,10 @@ if ($id > 0 || !empty($ref)) {
|
|||
$sql .= " AND d.fk_commande = c.rowid";
|
||||
$sql .= " AND d.fk_product = ".((int) $product->id);
|
||||
if (!empty($search_month)) {
|
||||
$sql .= ' AND MONTH(c.date_commande) IN ('.$db->sanitize($search_month).')';
|
||||
$sql .= " AND MONTH(c.date_commande) IN (".$db->sanitize($search_month).")";
|
||||
}
|
||||
if (!empty($search_year)) {
|
||||
$sql .= ' AND YEAR(c.date_commande) IN ('.$db->sanitize($search_year).')';
|
||||
$sql .= " AND YEAR(c.date_commande) IN (".$db->sanitize($search_year).")";
|
||||
}
|
||||
if (!$user->hasRight('societe', 'client', 'voir')) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
|
|
@ -166,6 +174,11 @@ if ($id > 0 || !empty($ref)) {
|
|||
if ($socid) {
|
||||
$sql .= " AND c.fk_soc = ".((int) $socid);
|
||||
}
|
||||
|
||||
if ($search_status != '') {
|
||||
$sql .= " AND c.fk_statut IN (".$db->sanitize($search_status).")";
|
||||
}
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
//Calcul total qty and amount for global if full scan list
|
||||
|
|
@ -197,6 +210,10 @@ if ($id > 0 || !empty($ref)) {
|
|||
$option .= '&search_year='.urlencode($search_year);
|
||||
}
|
||||
|
||||
if ($search_status != '') {
|
||||
$option .= '&search_status='.urlencode($search_status);
|
||||
}
|
||||
|
||||
print '<form method="post" action="'.$_SERVER ['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
if (!empty($sortfield)) {
|
||||
|
|
@ -217,6 +234,8 @@ if ($id > 0 || !empty($ref)) {
|
|||
print $langs->trans('Period').' ('.$langs->trans("OrderDate").') - ';
|
||||
print $langs->trans('Month').':<input class="flat" type="text" size="4" name="search_month" value="'.$search_month.'"> ';
|
||||
print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
|
||||
print $langs->trans('Status');
|
||||
$formorder->selectOrderStatus($search_status, 1, 'search_status');
|
||||
print '<div style="vertical-align: middle; display: inline-block">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"), 'search.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('orders', 'products', 'companies'));
|
||||
|
|
@ -67,10 +68,16 @@ if (!$sortfield) {
|
|||
}
|
||||
$search_month = GETPOST('search_month', 'int');
|
||||
$search_year = GETPOST('search_year', 'int');
|
||||
if (GETPOSTISARRAY('search_status')) {
|
||||
$search_status = join(',', GETPOST('search_status', 'array:intcomma'));
|
||||
} else {
|
||||
$search_status = (GETPOST('search_status', 'intcomma') != '' ? GETPOST('search_status', 'intcomma') : GETPOST('statut', 'intcomma'));
|
||||
}
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
$search_month = '';
|
||||
$search_year = '';
|
||||
$search_status = '';
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
|
||||
|
|
@ -85,6 +92,7 @@ $societestatic = new Societe($db);
|
|||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formorder = new FormOrder($db);
|
||||
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$product = new Product($db);
|
||||
|
|
@ -155,10 +163,10 @@ if ($id > 0 || !empty($ref)) {
|
|||
$sql .= " AND d.fk_commande = c.rowid";
|
||||
$sql .= " AND d.fk_product = ".((int) $product->id);
|
||||
if (!empty($search_month)) {
|
||||
$sql .= ' AND MONTH(c.date_commande) IN ('.$db->sanitize($search_month).')';
|
||||
$sql .= " AND MONTH(c.date_commande) IN (".$db->sanitize($search_month).")";
|
||||
}
|
||||
if (!empty($search_year)) {
|
||||
$sql .= ' AND YEAR(c.date_commande) IN ('.$db->sanitize($search_year).')';
|
||||
$sql .= " AND YEAR(c.date_commande) IN (".$db->sanitize($search_year).")";
|
||||
}
|
||||
if (!$user->hasRight('societe', 'client', 'voir')) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
|
|
@ -166,6 +174,11 @@ if ($id > 0 || !empty($ref)) {
|
|||
if ($socid) {
|
||||
$sql .= " AND c.fk_soc = ".((int) $socid);
|
||||
}
|
||||
|
||||
if ($search_status != '') {
|
||||
$sql .= " AND c.fk_statut IN (".$db->sanitize($search_status).")";
|
||||
}
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Calcul total qty and amount for global if full scan list
|
||||
|
|
@ -197,6 +210,10 @@ if ($id > 0 || !empty($ref)) {
|
|||
$option .= '&search_year='.urlencode($search_year);
|
||||
}
|
||||
|
||||
if ($search_status != '') {
|
||||
$param .= '&search_status='.urlencode($search_status);
|
||||
}
|
||||
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
if (!empty($sortfield)) {
|
||||
|
|
@ -217,6 +234,8 @@ if ($id > 0 || !empty($ref)) {
|
|||
print $langs->trans('Period').' ('.$langs->trans("OrderDate").') - ';
|
||||
print $langs->trans('Month').':<input class="flat" type="text" size="4" name="search_month" value="'.$search_month.'"> ';
|
||||
print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
|
||||
print $langs->trans('Status');
|
||||
$formorder->selectSupplierOrderStatus($search_status, 1, 'search_status');
|
||||
print '<div style="vertical-align: middle; display: inline-block">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"), 'search.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
|
|
|
|||
|
|
@ -298,6 +298,7 @@ print '<br>';
|
|||
|
||||
print load_fiche_titre($langs->trans("ProjectsNumberingModules"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="100">'.$langs->trans("Name").'</td>';
|
||||
|
|
@ -387,13 +388,15 @@ foreach ($dirmodels as $reldir) {
|
|||
}
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
if (!getDolGlobalString('PROJECT_HIDE_TASKS')) {
|
||||
// Task numbering module
|
||||
print load_fiche_titre($langs->trans("TasksNumberingModules"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="100">'.$langs->trans("Name").'</td>';
|
||||
|
|
@ -483,7 +486,9 @@ if (!getDolGlobalString('PROJECT_HIDE_TASKS')) {
|
|||
}
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -515,8 +520,9 @@ if ($resql) {
|
|||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print ' <td width="100">'.$langs->trans("Name")."</td>\n";
|
||||
print " <td>".$langs->trans("Description")."</td>\n";
|
||||
print '<td class="center" width="60">'.$langs->trans("Activated")."</td>\n";
|
||||
|
|
@ -622,7 +628,9 @@ foreach ($dirmodels as $reldir) {
|
|||
}
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
|
||||
|
|
@ -655,8 +663,9 @@ if (!getDolGlobalString('PROJECT_HIDE_TASKS')) {
|
|||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print ' <td width="100">'.$langs->trans("Name")."</td>\n";
|
||||
print " <td>".$langs->trans("Description")."</td>\n";
|
||||
print '<td class="center" width="60">'.$langs->trans("Activated")."</td>\n";
|
||||
|
|
@ -761,7 +770,9 @@ if (!getDolGlobalString('PROJECT_HIDE_TASKS')) {
|
|||
}
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -775,6 +786,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
|||
print '<input type="hidden" name="action" value="updateoptions">';
|
||||
print '<input type="hidden" name="page_y" value="">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print "<td>".$langs->trans("Parameters")."</td>\n";
|
||||
|
|
@ -830,7 +842,7 @@ print '<input type="submit" class="button small reposition" name="PROJECT_TIMESH
|
|||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
|
|
|||
|
|
@ -1224,8 +1224,6 @@ class Project extends CommonObject
|
|||
*/
|
||||
public function setClose($user)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$error = 0;
|
||||
|
|
|
|||
|
|
@ -257,9 +257,6 @@ class Task extends CommonObjectLine
|
|||
return -1;
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task (";
|
||||
$sql .= "entity";
|
||||
|
|
@ -348,8 +345,6 @@ class Task extends CommonObjectLine
|
|||
*/
|
||||
public function fetch($id, $ref = '', $loadparentdata = 0)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql .= " t.rowid,";
|
||||
$sql .= " t.ref,";
|
||||
|
|
@ -603,7 +598,7 @@ class Task extends CommonObjectLine
|
|||
*/
|
||||
public function delete($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $conf;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$error = 0;
|
||||
|
|
@ -1217,9 +1212,15 @@ class Task extends CommonObjectLine
|
|||
}
|
||||
|
||||
/* Liste des taches et role sur les projects ou taches */
|
||||
$sql = "SELECT pt.rowid as pid, ec.element_id, ctc.code, ctc.source";
|
||||
$sql = "SELECT ";
|
||||
if ($userp) {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet as pt";
|
||||
$sql .= " p.rowid as pid,";
|
||||
} else {
|
||||
$sql .= " pt.rowid as pid,";
|
||||
}
|
||||
$sql .= " ec.element_id, ctc.code, ctc.source";
|
||||
if ($userp) {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
}
|
||||
if ($usert && $filteronprojstatus > -1) {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."projet_task as pt";
|
||||
|
|
@ -1229,7 +1230,11 @@ class Task extends CommonObjectLine
|
|||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||
$sql .= " WHERE pt.rowid = ec.element_id";
|
||||
if ($userp) {
|
||||
$sql .= " WHERE p.rowid = ec.element_id";
|
||||
} else {
|
||||
$sql .= " WHERE pt.rowid = ec.element_id";
|
||||
}
|
||||
if ($userp && $filteronprojstatus > -1) {
|
||||
$sql .= " AND p.fk_statut = ".((int) $filteronprojstatus);
|
||||
}
|
||||
|
|
@ -1253,7 +1258,7 @@ class Task extends CommonObjectLine
|
|||
$sql .= " AND ctc.source = 'internal'";
|
||||
if ($projectid) {
|
||||
if ($userp) {
|
||||
$sql .= " AND pt.rowid IN (".$this->db->sanitize($projectid).")";
|
||||
$sql .= " AND p.rowid IN (".$this->db->sanitize($projectid).")";
|
||||
}
|
||||
if ($usert) {
|
||||
$sql .= " AND pt.fk_projet IN (".$this->db->sanitize($projectid).")";
|
||||
|
|
@ -1438,8 +1443,6 @@ class Task extends CommonObjectLine
|
|||
*/
|
||||
public function fetchTimeSpentOnTask($morewherefilter = '')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$arrayres = array();
|
||||
|
||||
$sql = "SELECT";
|
||||
|
|
@ -1646,8 +1649,6 @@ class Task extends CommonObjectLine
|
|||
*/
|
||||
public function fetchTimeSpent($id)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$timespent = new TimeSpent($this->db);
|
||||
$timespent->fetch($id);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,14 +25,13 @@ require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
|
|||
/**
|
||||
* API class for salaries
|
||||
*
|
||||
* @property DoliDB db
|
||||
* @access protected
|
||||
* @class DolibarrApiAccess {@requires user,external}
|
||||
*/
|
||||
class Salaries extends DolibarrApi
|
||||
{
|
||||
/**
|
||||
* array $FIELDS Mandatory fields, checked when creating an object
|
||||
* @var array $FIELDS Mandatory fields, checked when creating an object
|
||||
*/
|
||||
static $FIELDS = array(
|
||||
'fk_user',
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2023 Alexandre Janniaux <alexandre.janniaux@gmail.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.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
|
||||
|
|
@ -48,9 +49,6 @@ $conf->global->MAIN_DISABLE_ALL_MAILS = 1;
|
|||
*/
|
||||
class AdminLibTest extends CommonClassTest
|
||||
{
|
||||
protected $backupGlobalsBlacklist = array('conf', 'user', 'langs', 'db');
|
||||
|
||||
|
||||
/**
|
||||
* testVersionCompare
|
||||
*
|
||||
|
|
|
|||
|
|
@ -144,13 +144,100 @@ class ProjectTest extends CommonClassTest
|
|||
return $localobject->id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* testTaskCreate
|
||||
*
|
||||
* @param int $idproject ID project
|
||||
* @return void
|
||||
*
|
||||
* @depends testProjectOther
|
||||
* The depends says test is run only if previous is ok
|
||||
*/
|
||||
public function testTaskCreate($idproject)
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf = $this->savconf;
|
||||
$user = $this->savuser;
|
||||
$langs = $this->savlangs;
|
||||
$db = $this->savdb;
|
||||
|
||||
$localobject = new Task($db);
|
||||
$localobject->initAsSpecimen();
|
||||
$localobject->fk_project = $idproject;
|
||||
$result = $localobject->create($user);
|
||||
|
||||
$this->assertLessThan($result, 0);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* testTaskFetch
|
||||
*
|
||||
* @param int $id Id of object
|
||||
* @return void
|
||||
*
|
||||
* @depends testTaskCreate
|
||||
* The depends says test is run only if previous is ok
|
||||
*/
|
||||
public function testTaskFetch($id)
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf = $this->savconf;
|
||||
$user = $this->savuser;
|
||||
$langs = $this->savlangs;
|
||||
$db = $this->savdb;
|
||||
|
||||
$localobject = new Task($db);
|
||||
$result = $localobject->fetch($id);
|
||||
|
||||
$this->assertLessThan($result, 0);
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
/**
|
||||
* testTaskOther
|
||||
*
|
||||
* @param Task $localobject Task
|
||||
* @return int
|
||||
*
|
||||
* @depends testTaskFetch
|
||||
* The depends says test is run only if previous is ok
|
||||
*/
|
||||
public function testTaskOther($localobject)
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf = $this->savconf;
|
||||
$user = $this->savuser;
|
||||
$langs = $this->savlangs;
|
||||
$db = $this->savdb;
|
||||
|
||||
$usertoprocess = $user;
|
||||
$onlyopenedproject = 0;
|
||||
|
||||
$taskstatic = new Task($db);
|
||||
//$result = $localobject->setClose($user);
|
||||
$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, null, $localobject->fk_project, 0, $onlyopenedproject);
|
||||
$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(null, $usertoprocess, $localobject->fk_project, 0, $onlyopenedproject);
|
||||
|
||||
print __METHOD__." id=".$localobject->id."\n";
|
||||
$this->assertEquals(count($projectsrole), 0);
|
||||
$this->assertEquals(count($tasksrole), 0);
|
||||
|
||||
return $localobject->fk_project;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* testProjectDelete
|
||||
*
|
||||
* @param int $id Id of project
|
||||
* @return void
|
||||
*
|
||||
* @depends testProjectOther
|
||||
* @depends testTaskOther
|
||||
* The depends says test is run only if previous is ok
|
||||
*/
|
||||
public function testProjectDelete($id)
|
||||
|
|
|
|||
|
|
@ -1,45 +1,53 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE phpunit SYSTEM "phpunit.dtd" >
|
||||
<phpunit
|
||||
backupGlobals="false"
|
||||
backupStaticAttributes="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
colors="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="true">
|
||||
<php>
|
||||
<ini name="max_execution_time" value="1800"/>
|
||||
<ini name="max_input_time" value="1800"/>
|
||||
<ini name="memory_limit" value="4G" />
|
||||
<!-- Also don't forget to change suhosin.memory_limit=4G -->
|
||||
</php>
|
||||
<filter>
|
||||
<whitelist addUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".class.php">../../htdocs/</directory>
|
||||
<directory suffix=".lib.php">../../htdocs/</directory>
|
||||
<directory suffix=".inc.php">../../htdocs/</directory>
|
||||
<directory suffix=".modules.php">../../htdocs/</directory>
|
||||
<file>../../htdocs/core/modules/facture/modules_facture.php</file>
|
||||
<file>../../htdocs/core/modules/commande/modules_commande.php</file>
|
||||
<file>../../htdocs/core/modules/propale/modules_propale.php</file>
|
||||
<file>../../htdocs/core/modules/project/modules_project.php</file>
|
||||
<file>../../htdocs/core/modules/fichinter/modules_fichinter.php</file>
|
||||
<exclude>
|
||||
<directory suffix=".php">../../build/</directory>
|
||||
<directory suffix=".php">../../dev/</directory>
|
||||
<directory suffix=".php">../../doc/</directory>
|
||||
<directory suffix=".php">../../test/</directory>
|
||||
<directory suffix=".php">../../documents/</directory>
|
||||
<directory suffix=".php">../../htdocs/custom/</directory>
|
||||
<directory suffix=".php">../../htdocs/documents/custom/</directory>
|
||||
<directory suffix=".php">../../htdocs/nltechno/</directory>
|
||||
<directory suffix=".php">../../htdocs/products/canvas/</directory>
|
||||
<directory suffix=".php">../../htdocs/contact/canvas/</directory>
|
||||
<directory suffix=".php">../../htdocs/societe/canvas/</directory>
|
||||
<directory suffix=".php">../../htdocs/includes/</directory>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</filter>
|
||||
backupGlobals="false"
|
||||
backupStaticAttributes="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
colors="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false">
|
||||
<php>
|
||||
<ini name="max_execution_time" value="1800"/>
|
||||
<!-- Also don't forget to change suhosin.memory_limit=4G -->
|
||||
<ini name="max_input_time" value="1800"/>
|
||||
<ini name="fail_on_warning" value="On"/>
|
||||
<ini name="fail_on_deprecation" value="On"/>
|
||||
<ini name="fail_on_notice" value="On"/>
|
||||
<ini name="display_startup_errors" value="On"/>
|
||||
<ini name="display_errors" value="On"/>
|
||||
<ini name="display_notices" value="On"/>
|
||||
<ini name="display_warnings" value="On"/>
|
||||
<ini name="display_deprecations" value="On"/>
|
||||
<ini name="memory_limit" value="4G" />
|
||||
</php>
|
||||
<coverage>
|
||||
<include>
|
||||
<directory suffix=".class.php">../../htdocs/</directory>
|
||||
<directory suffix=".lib.php">../../htdocs/</directory>
|
||||
<directory suffix=".inc.php">../../htdocs/</directory>
|
||||
<directory suffix=".modules.php">../../htdocs/</directory>
|
||||
<file>../../htdocs/core/modules/facture/modules_facture.php</file>
|
||||
<file>../../htdocs/core/modules/commande/modules_commande.php</file>
|
||||
<file>../../htdocs/core/modules/propale/modules_propale.php</file>
|
||||
<file>../../htdocs/core/modules/project/modules_project.php</file>
|
||||
<file>../../htdocs/core/modules/fichinter/modules_fichinter.php</file>
|
||||
</include>
|
||||
<exclude>
|
||||
<directory suffix=".php">../../build/</directory>
|
||||
<directory suffix=".php">../../dev/</directory>
|
||||
<directory suffix=".php">../../doc/</directory>
|
||||
<directory suffix=".php">../../test/</directory>
|
||||
<directory suffix=".php">../../documents/</directory>
|
||||
<directory suffix=".php">../../htdocs/custom/</directory>
|
||||
<directory suffix=".php">../../htdocs/documents/custom/</directory>
|
||||
<directory suffix=".php">../../htdocs/nltechno/</directory>
|
||||
<directory suffix=".php">../../htdocs/products/canvas/</directory>
|
||||
<directory suffix=".php">../../htdocs/contact/canvas/</directory>
|
||||
<directory suffix=".php">../../htdocs/societe/canvas/</directory>
|
||||
<directory suffix=".php">../../htdocs/includes/</directory>
|
||||
</exclude>
|
||||
</coverage>
|
||||
</phpunit>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user