Fix scrutinizer

This commit is contained in:
Maxime Kohlhaas 2022-05-22 01:19:00 +02:00
parent fb776e2a96
commit 6131d5a2b4
4 changed files with 16 additions and 137 deletions

View File

@ -2069,69 +2069,6 @@ class Expedition extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update/create delivery method.
*
* @param string $id id method to activate
*
* @return void
*/
public function update_delivery_method($id = '')
{
// phpcs:enable
if ($id == '') {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)";
$sql .= " VALUES ('".$this->db->escape($this->update['code'])."','".$this->db->escape($this->update['libelle'])."','".$this->db->escape($this->update['description'])."','".$this->db->escape($this->update['tracking'])."')";
$resql = $this->db->query($sql);
} else {
$sql = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode SET";
$sql .= " code='".$this->db->escape($this->update['code'])."'";
$sql .= ",libelle='".$this->db->escape($this->update['libelle'])."'";
$sql .= ",description='".$this->db->escape($this->update['description'])."'";
$sql .= ",tracking='".$this->db->escape($this->update['tracking'])."'";
$sql .= " WHERE rowid=".((int) $id);
$resql = $this->db->query($sql);
}
if ($resql < 0) {
dol_print_error($this->db, '');
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Activate delivery method.
*
* @param int $id id method to activate
* @return void
*/
public function activ_delivery_method($id)
{
// phpcs:enable
$sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=1';
$sql .= " WHERE rowid = ".((int) $id);
$resql = $this->db->query($sql);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* DesActivate delivery method.
*
* @param int $id id method to desactivate
*
* @return void
*/
public function disable_delivery_method($id)
{
// phpcs:enable
$sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=0';
$sql .= " WHERE rowid= ".((int) $id);
$resql = $this->db->query($sql);
}
/**
* Forge an set tracking url
*

View File

@ -80,6 +80,13 @@ class CommandeFournisseurDispatch extends CommonObjectLine
public $fk_commandefourndet;
public $qty;
public $qty_asked;
public $libelle;
public $desc;
public $tva_tx;
public $vat_src_code;
public $ref_supplier;
/**
* @var int ID

View File

@ -270,9 +270,9 @@ if (empty($reshook)) {
$object->origin_id = $origin_id;
$object->fk_project = GETPOST('projectid', 'int');
$object->weight = GETPOST('weight', 'int') == '' ? null : GETPOST('weight', 'int');
$object->sizeH = GETPOST('sizeH', 'int') == '' ? null : GETPOST('sizeH', 'int');
$object->sizeW = GETPOST('sizeW', 'int') == '' ? null : GETPOST('sizeW', 'int');
$object->sizeS = GETPOST('sizeS', 'int') == '' ? null : GETPOST('sizeS', 'int');
$object->trueHeight = GETPOST('trueHeight', 'int') == '' ? null : GETPOST('trueHeight', 'int');
$object->trueWidth = GETPOST('trueWidth', 'int') == '' ? null : GETPOST('trueWidth', 'int');
$object->trueDepth = GETPOST('trueDepth', 'int') == '' ? null : GETPOST('trueDepth', 'int');
$object->size_units = GETPOST('size_units', 'int');
$object->weight_units = GETPOST('weight_units', 'int');
@ -849,9 +849,9 @@ if ($action == 'create') {
// Dim
print '<tr><td>';
print $langs->trans("Width").' x '.$langs->trans("Height").' x '.$langs->trans("Depth");
print ' </td><td colspan="3"><input name="sizeW" size="4" value="'.GETPOST('sizeW', 'int').'">';
print ' x <input name="sizeH" size="4" value="'.GETPOST('sizeH', 'int').'">';
print ' x <input name="sizeS" size="4" value="'.GETPOST('sizeS', 'int').'">';
print ' </td><td colspan="3"><input name="trueWidth" size="4" value="'.GETPOST('trueWidth', 'int').'">';
print ' x <input name="trueHeight" size="4" value="'.GETPOST('trueHeight', 'int').'">';
print ' x <input name="trueDepth" size="4" value="'.GETPOST('trueDepth', 'int').'">';
print ' ';
$text = $formproduct->selectMeasuringUnits("size_units", "size", GETPOST('size_units', 'int'), 0, 2);
$htmltext = $langs->trans("KeepEmptyForAutoCalculation");

View File

@ -273,9 +273,9 @@ class Reception extends CommonObject
$sql .= ", ".($this->shipping_method_id > 0 ? ((int) $this->shipping_method_id) : "null");
$sql .= ", '".$this->db->escape($this->tracking_number)."'";
$sql .= ", ".(is_null($this->weight) ? "NULL" : ((double) $this->weight));
$sql .= ", ".(is_null($this->sizeS) ? "NULL" : ((double) $this->sizeS)); // TODO Should use this->trueDepth
$sql .= ", ".(is_null($this->sizeW) ? "NULL" : ((double) $this->sizeW)); // TODO Should use this->trueWidth
$sql .= ", ".(is_null($this->sizeH) ? "NULL" : ((double) $this->sizeH)); // TODO Should use this->trueHeight
$sql .= ", ".(is_null($this->trueDepth) ? "NULL" : ((double) $this->trueDepth));
$sql .= ", ".(is_null($this->trueWidth) ? "NULL" : ((double) $this->trueWidth));
$sql .= ", ".(is_null($this->trueHeight) ? "NULL" : ((double) $this->trueHeight));
$sql .= ", ".(is_null($this->weight_units) ? "NULL" : ((double) $this->weight_units));
$sql .= ", ".(is_null($this->size_units) ? "NULL" : ((double) $this->size_units));
$sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null");
@ -744,7 +744,6 @@ class Reception extends CommonObject
if (!empty($this->origin) && $this->origin_id > 0 && ($this->origin == 'order_supplier' || $this->origin == 'commandeFournisseur')) {
if (empty($this->commandeFournisseur)) {
$this->commandeFournisseur = null;
$this->fetch_origin();
if (empty($this->commandeFournisseur->lines)) {
$res = $this->commandeFournisseur->fetch_lines();
@ -1485,70 +1484,6 @@ class Reception extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update/create delivery method.
*
* @param string $id id method to activate
*
* @return void
*/
public function update_delivery_method($id = '')
{
// phpcs:enable
if ($id == '') {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)";
$sql .= " VALUES ('".$this->db->escape($this->update['code'])."','".$this->db->escape($this->update['libelle'])."','".$this->db->escape($this->update['description'])."','".$this->db->escape($this->update['tracking'])."')";
$resql = $this->db->query($sql);
} else {
$sql = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode SET";
$sql .= " code='".$this->db->escape($this->update['code'])."'";
$sql .= ",libelle='".$this->db->escape($this->update['libelle'])."'";
$sql .= ",description='".$this->db->escape($this->update['description'])."'";
$sql .= ",tracking='".$this->db->escape($this->update['tracking'])."'";
$sql .= " WHERE rowid=".((int) $id);
$resql = $this->db->query($sql);
}
if ($resql < 0) {
dol_print_error($this->db, '');
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Activate delivery method.
*
* @param int $id id method to activate
*
* @return void
*/
public function activ_delivery_method($id)
{
// phpcs:enable
$sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=1';
$sql .= " WHERE rowid = ".((int) $id);
$resql = $this->db->query($sql);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* DesActivate delivery method.
*
* @param int $id id method to desactivate
*
* @return void
*/
public function disable_delivery_method($id)
{
// phpcs:enable
$sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=0';
$sql .= " WHERE rowid = ".((int) $id);
$resql = $this->db->query($sql);
}
/**
* Forge an set tracking url
*