2
0
forked from Wavyzz/dolibarr

Fix technical debt

This commit is contained in:
Laurent Destailleur
2023-01-06 19:24:57 +01:00
parent 646f6c7bc7
commit 5280d070e3
14 changed files with 110 additions and 71 deletions

View File

@@ -1173,6 +1173,8 @@ class Commande extends CommonOrder
return -1;
}
}
return 0;
} else {
dol_print_error($this->db);
$this->db->rollback();
@@ -2307,17 +2309,13 @@ class Commande extends CommonOrder
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns a array with expeditions lines number
* Returns an array with expeditions lines number
*
* @return int Nb of shipments
*
* TODO deprecate, move to Shipping class
*/
public function nb_expedition()
public function countNbOfShipments()
{
// phpcs:enable
$sql = 'SELECT count(*)';
$sql .= ' FROM '.MAIN_DB_PREFIX.'expedition as e';
$sql .= ', '.MAIN_DB_PREFIX.'element_element as el';
@@ -2333,6 +2331,8 @@ class Commande extends CommonOrder
} else {
dol_print_error($this->db);
}
return 0;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -2501,6 +2501,8 @@ class Commande extends CommonOrder
return -1 * $error;
}
}
return 0;
}
@@ -2565,6 +2567,8 @@ class Commande extends CommonOrder
return -1 * $error;
}
}
return 0;
}
@@ -3433,7 +3437,7 @@ class Commande extends CommonOrder
}
// Test we can delete
if ($this->nb_expedition() != 0) {
if ($this->countNbOfShipments() != 0) {
$this->errors[] = $langs->trans('SomeShipmentExists');
$error++;
}