mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 00:52:01 +01:00
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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")).'">';
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user