forked from Wavyzz/dolibarr
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -61,7 +61,7 @@ class FormContract
|
||||
* @param int $showRef Show customer and supplier reference on each contract (when found)
|
||||
* @param int $noouput 1=Return the output instead of display
|
||||
* @param string $morecss More CSS
|
||||
* @return int Nbr of contract if OK, <0 if KO
|
||||
* @return int|string If nooutput = 0: Nbr of contract if OK, <0 if KO, If nooutput = 1: The HTML select string
|
||||
*/
|
||||
public function select_contract($socid = -1, $selected = 0, $htmlname = 'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0, $noouput = 0, $morecss = 'minwidth150')
|
||||
{
|
||||
|
||||
@@ -474,7 +474,7 @@ class SupplierInvoices extends DolibarrApi
|
||||
$paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
|
||||
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
|
||||
$paiement->paiementid = $payment_mode_id;
|
||||
$paiement->paiementcode = dol_getIdFromCode($this->db, $payment_mode_id, 'c_paiement', 'id', 'code', 1);
|
||||
$paiement->paiementcode = (string) dol_getIdFromCode($this->db, $payment_mode_id, 'c_paiement', 'id', 'code', 1);
|
||||
$paiement->num_payment = $num_payment;
|
||||
$paiement->note_public = $comment;
|
||||
|
||||
@@ -704,7 +704,12 @@ class SupplierInvoices extends DolibarrApi
|
||||
|
||||
$updateRes = $this->invoice->deleteLine($lineid);
|
||||
if ($updateRes > 0) {
|
||||
return $this->get($id);
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'line '.$lineid.' deleted'
|
||||
)
|
||||
);
|
||||
} else {
|
||||
throw new RestException(405, $this->invoice->error);
|
||||
}
|
||||
|
||||
@@ -1249,7 +1249,7 @@ class FactureFournisseurRec extends CommonInvoice
|
||||
* Format string to output with by striking the string if max number of generation was reached
|
||||
*
|
||||
* @param string $ret Default value to output
|
||||
* @return boolean False by default, True if maximum number of generation is reached
|
||||
* @return string False by default, True if maximum number of generation is reached
|
||||
*/
|
||||
public function strikeIfMaxNbGenReached($ret)
|
||||
{
|
||||
|
||||
@@ -311,7 +311,13 @@ if (empty($reshook)) {
|
||||
// Creation of payment line
|
||||
$paiement = new PaiementFourn($db);
|
||||
$paiement->datepaye = $datepaye;
|
||||
$paiement->amounts = $amounts; // Array of amounts
|
||||
|
||||
$correctedAmounts = [];
|
||||
foreach ($amounts as $key => $value) {
|
||||
$correctedAmounts[$key] = (float) $value;
|
||||
}
|
||||
|
||||
$paiement->amounts = $correctedAmounts; // Array of amounts
|
||||
$paiement->multicurrency_amounts = $multicurrency_amounts;
|
||||
$paiement->multicurrency_code = $multicurrency_code; // Array with all currency of payments dispatching
|
||||
$paiement->multicurrency_tx = $multicurrency_tx; // Array with all currency tx of payments dispatching
|
||||
|
||||
@@ -382,11 +382,11 @@ class Tickets extends DolibarrApi
|
||||
$this->ticket->$field = $value;
|
||||
}
|
||||
|
||||
if ($this->ticket->update(DolibarrApiAccess::$user)) {
|
||||
if ($this->ticket->update(DolibarrApiAccess::$user) > 0) {
|
||||
return $this->get($id);
|
||||
} else {
|
||||
throw new RestException(500, $this->ticket->error);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -923,7 +923,7 @@ class Website extends CommonObject
|
||||
$this->lang = 'en';
|
||||
$this->otherlang = 'fr,es';
|
||||
$this->status = 1;
|
||||
$this->fk_default_home = null;
|
||||
$this->fk_default_home = 0;
|
||||
$this->virtualhost = 'http://myvirtualhost';
|
||||
$this->fk_user_creat = $user->id;
|
||||
$this->fk_user_modif = $user->id;
|
||||
|
||||
@@ -116,11 +116,7 @@ abstract class CommonClassTest extends TestCase
|
||||
if ($t instanceof PHPUnit\Framework\Error\Notice) {
|
||||
$nbLinesToShow = 3;
|
||||
}
|
||||
$totalLines = count($lines);
|
||||
$first_line = max(0, $totalLines - $nbLinesToShow);
|
||||
|
||||
// Get the last line of the log
|
||||
$last_lines = array_slice($lines, $first_line, $nbLinesToShow);
|
||||
|
||||
$failedTestMethod = $this->getName(false);
|
||||
$className = get_called_class();
|
||||
@@ -131,14 +127,25 @@ abstract class CommonClassTest extends TestCase
|
||||
// Get the test method's data set
|
||||
$argsText = $this->getDataSetAsString(true);
|
||||
|
||||
// Show log file
|
||||
$totalLines = count($lines);
|
||||
$first_line = max(0, $totalLines - $nbLinesToShow);
|
||||
// Get the last line of the log
|
||||
$last_lines = array_slice($lines, $first_line, $nbLinesToShow);
|
||||
|
||||
print PHP_EOL;
|
||||
print "----- $className::$failedTestMethod failed - $argsText.".PHP_EOL;
|
||||
print "Show last ".$nbLinesToShow." lines of dolibarr.log file -----".PHP_EOL;
|
||||
foreach ($last_lines as $line) {
|
||||
print $line.PHP_EOL;
|
||||
// Use GitHub Action compatible group output (:warning: arguments not encoded)
|
||||
print "##[group]$className::$failedTestMethod failed - $argsText.".PHP_EOL;
|
||||
print "## Exception: {$t->getMessage()}".PHP_EOL;
|
||||
|
||||
if ($nbLinesToShow) {
|
||||
// Show partial log file contents when requested.
|
||||
print "## Show last ".$nbLinesToShow." lines of dolibarr.log file -----".PHP_EOL;
|
||||
foreach ($last_lines as $line) {
|
||||
print $line.PHP_EOL;
|
||||
}
|
||||
print "## end of dolibarr.log for $className::$failedTestMethod".PHP_EOL;
|
||||
}
|
||||
print "----- end of dolibarr.log for $className::$failedTestMethod".PHP_EOL;
|
||||
print "##[endgroup]".PHP_EOL;
|
||||
|
||||
parent::onNotSuccessfulTest($t);
|
||||
}
|
||||
@@ -359,4 +366,24 @@ abstract class CommonClassTest extends TestCase
|
||||
$this->assertDirectoryDoesNotExist($directory, $message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that a file does not exist without triggering deprecation
|
||||
*
|
||||
* @param string $file The file to test
|
||||
* @param string $message The message to show if the directory exists
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function assertFileNotExistsCompat($file, $message = '')
|
||||
{
|
||||
$phpunitVersion = \PHPUnit\Runner\Version::id();
|
||||
|
||||
// Check if PHPUnit version is less than 9.0.0
|
||||
if (version_compare($phpunitVersion, '9.0.0', '<')) {
|
||||
$this->assertFileNotExists($file, $message);
|
||||
} else {
|
||||
$this->assertFileDoesNotExist($file, $message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user