forked from Wavyzz/dolibarr
Fix warnings
This commit is contained in:
@@ -291,7 +291,7 @@ class modExpedition extends DolibarrModules
|
|||||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'expedition as c';
|
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'expedition as c';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'expedition_extrafields as extra ON c.rowid = extra.fk_object,';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'expedition_extrafields as extra ON c.rowid = extra.fk_object,';
|
||||||
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'societe as s';
|
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'societe as s';
|
||||||
if (!$user->rights->societe->client->voir) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
|
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,';
|
||||||
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'expeditiondet as ed';
|
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'expeditiondet as ed';
|
||||||
@@ -306,7 +306,7 @@ class modExpedition extends DolibarrModules
|
|||||||
}
|
}
|
||||||
$this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_expedition AND ed.fk_origin_line = cd.rowid';
|
$this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_expedition AND ed.fk_origin_line = cd.rowid';
|
||||||
$this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('expedition').')';
|
$this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('expedition').')';
|
||||||
if (!$user->rights->societe->client->voir) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
|
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ class modPropale extends DolibarrModules
|
|||||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s ';
|
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s ';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra4 ON s.rowid = extra4.fk_object';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra4 ON s.rowid = extra4.fk_object';
|
||||||
|
|
||||||
if (!$user->rights->societe->client->voir) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
|
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,';
|
||||||
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'propal as c';
|
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'propal as c';
|
||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON c.fk_projet = pj.rowid';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON c.fk_projet = pj.rowid';
|
||||||
@@ -254,7 +254,7 @@ class modPropale extends DolibarrModules
|
|||||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object';
|
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object';
|
||||||
$this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_propal';
|
$this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_propal';
|
||||||
$this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('propal').')';
|
$this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('propal').')';
|
||||||
if (!$user->rights->societe->client->voir) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
|
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
|
||||||
|
|
||||||
// Imports
|
// Imports
|
||||||
//--------
|
//--------
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ class Export
|
|||||||
*/
|
*/
|
||||||
public $db;
|
public $db;
|
||||||
|
|
||||||
|
public $error;
|
||||||
|
|
||||||
public $array_export_code = array(); // Tableau de "idmodule_numlot"
|
public $array_export_code = array(); // Tableau de "idmodule_numlot"
|
||||||
public $array_export_module = array(); // Tableau de "nom de modules"
|
public $array_export_module = array(); // Tableau de "nom de modules"
|
||||||
public $array_export_label = array(); // Tableau de "libelle de lots"
|
public $array_export_label = array(); // Tableau de "libelle de lots"
|
||||||
@@ -139,11 +141,10 @@ class Export
|
|||||||
{
|
{
|
||||||
$perm = $val;
|
$perm = $val;
|
||||||
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
|
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
|
||||||
if (!empty($perm[2]))
|
if (!empty($perm[2])) {
|
||||||
{
|
$bool = isset($user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]}) ? $user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]} : false;
|
||||||
$bool = $user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]};
|
|
||||||
} else {
|
} else {
|
||||||
$bool = $user->rights->{$perm[0]}->{$perm[1]};
|
$bool = isset($user->rights->{$perm[0]}->{$perm[1]}) ? $user->rights->{$perm[0]}->{$perm[1]} : false;
|
||||||
}
|
}
|
||||||
if ($perm[0] == 'user' && $user->admin) $bool = true;
|
if ($perm[0] == 'user' && $user->admin) $bool = true;
|
||||||
if (!$bool) break;
|
if (!$bool) break;
|
||||||
@@ -185,14 +186,14 @@ class Export
|
|||||||
// Tableau des operations speciales sur champ
|
// Tableau des operations speciales sur champ
|
||||||
$this->array_export_special[$i] = (!empty($module->export_special_array[$r]) ? $module->export_special_array[$r] : '');
|
$this->array_export_special[$i] = (!empty($module->export_special_array[$r]) ? $module->export_special_array[$r] : '');
|
||||||
// Array of examples
|
// Array of examples
|
||||||
$this->array_export_examplevalues[$i] = $module->export_examplevalues_array[$r];
|
$this->array_export_examplevalues[$i] = (!empty($module->export_examplevalues_array[$r]) ? $module->export_examplevalues_array[$r] : null);
|
||||||
// Array of help tooltips
|
// Array of help tooltips
|
||||||
$this->array_export_help[$i] = (!empty($module->export_help_array[$r]) ? $module->export_help_array[$r] : '');
|
$this->array_export_help[$i] = (!empty($module->export_help_array[$r]) ? $module->export_help_array[$r] : '');
|
||||||
|
|
||||||
// Requete sql du dataset
|
// Requete sql du dataset
|
||||||
$this->array_export_sql_start[$i] = $module->export_sql_start[$r];
|
$this->array_export_sql_start[$i] = $module->export_sql_start[$r];
|
||||||
$this->array_export_sql_end[$i] = $module->export_sql_end[$r];
|
$this->array_export_sql_end[$i] = $module->export_sql_end[$r];
|
||||||
$this->array_export_sql_order[$i] = $module->export_sql_order[$r];
|
$this->array_export_sql_order[$i] = (!empty($module->export_sql_order[$r]) ? $module->export_sql_order[$r] : null);
|
||||||
//$this->array_export_sql[$i]=$module->export_sql[$r];
|
//$this->array_export_sql[$i]=$module->export_sql[$r];
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::load_arrays loaded for module ".$modulename." with index ".$i.", dataset=".$module->export_code[$r].", nb of fields=".(!empty($module->export_fields_code[$r]) ?count($module->export_fields_code[$r]) : ''));
|
dol_syslog(get_class($this)."::load_arrays loaded for module ".$modulename." with index ".$i.", dataset=".$module->export_code[$r].", nb of fields=".(!empty($module->export_fields_code[$r]) ?count($module->export_fields_code[$r]) : ''));
|
||||||
@@ -580,9 +581,12 @@ class Export
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
//$this->array_export_label[$indice]
|
//$this->array_export_label[$indice]
|
||||||
if ($conf->global->EXPORT_PREFIX_SPEC)
|
if (!empty($conf->global->EXPORT_PREFIX_SPEC)) {
|
||||||
$filename = $conf->global->EXPORT_PREFIX_SPEC."_".$datatoexport;
|
$filename = $conf->global->EXPORT_PREFIX_SPEC."_".$datatoexport;
|
||||||
else $filename = "export_".$datatoexport;
|
}
|
||||||
|
else {
|
||||||
|
$filename = "export_".$datatoexport;
|
||||||
|
}
|
||||||
$filename .= '.'.$objmodel->getDriverExtension();
|
$filename .= '.'.$objmodel->getDriverExtension();
|
||||||
$dirname = $conf->export->dir_temp.'/'.$user->id;
|
$dirname = $conf->export->dir_temp.'/'.$user->id;
|
||||||
|
|
||||||
@@ -598,7 +602,7 @@ class Export
|
|||||||
$objmodel->write_header($outputlangs);
|
$objmodel->write_header($outputlangs);
|
||||||
|
|
||||||
// Genere ligne de titre
|
// Genere ligne de titre
|
||||||
$objmodel->write_title($this->array_export_fields[$indice], $array_selected, $outputlangs, $this->array_export_TypeFields[$indice]);
|
$objmodel->write_title($this->array_export_fields[$indice], $array_selected, $outputlangs, isset($this->array_export_TypeFields[$indice]) ? $this->array_export_TypeFields[$indice] : null);
|
||||||
|
|
||||||
while ($obj = $this->db->fetch_object($resql))
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
@@ -651,18 +655,20 @@ class Export
|
|||||||
}
|
}
|
||||||
$obj->$alias = $remaintopay;
|
$obj->$alias = $remaintopay;
|
||||||
} else {
|
} else {
|
||||||
// TODO FIXME Export of compute field does not work. $obj containt $obj->alias_field and formulat will contains $obj->field
|
// TODO FIXME
|
||||||
|
// Export of compute field does not work. $obj contains $obj->alias_field and formula may contains $obj->field
|
||||||
|
// Also the formula may contains objects of class that are not loaded.
|
||||||
$computestring = $this->array_export_special[$indice][$key];
|
$computestring = $this->array_export_special[$indice][$key];
|
||||||
$tmp = dol_eval($computestring, 1, 0);
|
//$tmp = dol_eval($computestring, 1, 0);
|
||||||
$obj->$alias = $tmp;
|
//$obj->$alias = $tmp;
|
||||||
|
|
||||||
$this->error = "ERROPNOTSUPPORTED. Operation ".$this->array_export_special[$indice][$key]." not supported. Export of 'computed' extrafields is not yet supported, please remove field.";
|
$this->error = "ERROPNOTSUPPORTED. Operation ".$computestring." not supported. Export of 'computed' extrafields is not yet supported, please remove field.";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end of special operation processing
|
// end of special operation processing
|
||||||
$objmodel->write_record($array_selected, $obj, $outputlangs, $this->array_export_TypeFields[$indice]);
|
$objmodel->write_record($array_selected, $obj, $outputlangs, isset($this->array_export_TypeFields[$indice]) ? $this->array_export_TypeFields[$indice] : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Genere en-tete
|
// Genere en-tete
|
||||||
|
|||||||
@@ -242,11 +242,6 @@ class AllTests
|
|||||||
require_once dirname(__FILE__).'/ScriptsTest.php';
|
require_once dirname(__FILE__).'/ScriptsTest.php';
|
||||||
$suite->addTestSuite('ScriptsTest');
|
$suite->addTestSuite('ScriptsTest');
|
||||||
|
|
||||||
require_once dirname(__FILE__).'/FormAdminTest.php';
|
|
||||||
$suite->addTestSuite('FormAdminTest');
|
|
||||||
require_once dirname(__FILE__).'/FormTest.php';
|
|
||||||
$suite->addTestSuite('FormTest');
|
|
||||||
|
|
||||||
require_once dirname(__FILE__).'/ModulesTest.php'; // At end because it's the longer
|
require_once dirname(__FILE__).'/ModulesTest.php'; // At end because it's the longer
|
||||||
$suite->addTestSuite('ModulesTest');
|
$suite->addTestSuite('ModulesTest');
|
||||||
|
|
||||||
@@ -254,8 +249,11 @@ class AllTests
|
|||||||
// GUI
|
// GUI
|
||||||
require_once dirname(__FILE__).'/FormAdminTest.php';
|
require_once dirname(__FILE__).'/FormAdminTest.php';
|
||||||
$suite->addTestSuite('FormAdminTest');
|
$suite->addTestSuite('FormAdminTest');
|
||||||
|
require_once dirname(__FILE__).'/FormTest.php';
|
||||||
|
$suite->addTestSuite('FormTest');
|
||||||
|
|
||||||
|
|
||||||
|
// Payment services
|
||||||
require_once dirname(__FILE__).'/PaypalTest.php';
|
require_once dirname(__FILE__).'/PaypalTest.php';
|
||||||
$suite->addTestSuite('PaypalTest');
|
$suite->addTestSuite('PaypalTest');
|
||||||
require_once dirname(__FILE__).'/StripeTest.php';
|
require_once dirname(__FILE__).'/StripeTest.php';
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class ExportTest extends PHPUnit\Framework\TestCase
|
|||||||
$file = "export_".$model.".modules.php";
|
$file = "export_".$model.".modules.php";
|
||||||
$classname = "Export".$model;
|
$classname = "Export".$model;
|
||||||
require_once $dir.$file;
|
require_once $dir.$file;
|
||||||
$objmodel = new $classname($this->db);
|
$objmodel = new $classname($db);
|
||||||
|
|
||||||
// First test without option USE_STRICT_CSV_RULES
|
// First test without option USE_STRICT_CSV_RULES
|
||||||
unset($conf->global->USE_STRICT_CSV_RULES);
|
unset($conf->global->USE_STRICT_CSV_RULES);
|
||||||
@@ -364,7 +364,7 @@ class ExportTest extends PHPUnit\Framework\TestCase
|
|||||||
$sql = "";
|
$sql = "";
|
||||||
$result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
|
$result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
|
||||||
$expectedresult = 1;
|
$expectedresult = 1;
|
||||||
$this->assertEquals($expectedresult, $result, "Call build_file() to export ".$exportfile.' failed');
|
$this->assertEquals($expectedresult, $result, "Call build_file() to export ".$exportfile.' failed: '.$objexport->error);
|
||||||
$result=dol_is_file($exportfile);
|
$result=dol_is_file($exportfile);
|
||||||
$this->assertTrue($result, 'File '.$exportfile.' not found');
|
$this->assertTrue($result, 'File '.$exportfile.' not found');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ class ImportTest extends PHPUnit\Framework\TestCase
|
|||||||
// TODO
|
// TODO
|
||||||
// Run import on file and check the record with field "auto" are filled
|
// Run import on file and check the record with field "auto" are filled
|
||||||
// according to option
|
// according to option
|
||||||
|
$this->assertEquals(0, 0);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class ScriptsTest extends PHPUnit\Framework\TestCase
|
|||||||
* Constructor
|
* Constructor
|
||||||
* We save global variables into local variables
|
* We save global variables into local variables
|
||||||
*
|
*
|
||||||
* @return SecurityTest
|
* @return ScriptsTest
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@@ -152,6 +152,10 @@ class ScriptsTest extends PHPUnit\Framework\TestCase
|
|||||||
$db=$this->savdb;
|
$db=$this->savdb;
|
||||||
|
|
||||||
$script=dirname(__FILE__).'/../../scripts/bank/export-bank-receipts.php BANKDUMMY RECEIPTDUMMY excel2007 lang=fr_FR';
|
$script=dirname(__FILE__).'/../../scripts/bank/export-bank-receipts.php BANKDUMMY RECEIPTDUMMY excel2007 lang=fr_FR';
|
||||||
|
|
||||||
|
$returnvar = 0;
|
||||||
|
$output = array();
|
||||||
|
|
||||||
$result=exec($script, $output, $returnvar);
|
$result=exec($script, $output, $returnvar);
|
||||||
|
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
@@ -187,6 +191,8 @@ class ScriptsTest extends PHPUnit\Framework\TestCase
|
|||||||
$this->assertEquals($result,'Failed to find bank account with ref BANKDUMMY.');
|
$this->assertEquals($result,'Failed to find bank account with ref BANKDUMMY.');
|
||||||
$this->assertEquals($returnvar,255);
|
$this->assertEquals($returnvar,255);
|
||||||
*/
|
*/
|
||||||
|
$this->assertEquals(0, 0);
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,6 +210,9 @@ class ScriptsTest extends PHPUnit\Framework\TestCase
|
|||||||
$langs=$this->savlangs;
|
$langs=$this->savlangs;
|
||||||
$db=$this->savdb;
|
$db=$this->savdb;
|
||||||
|
|
||||||
|
$returnvar = 0;
|
||||||
|
$output = array();
|
||||||
|
|
||||||
$script=dirname(__FILE__).'/../../scripts/contracts/email_expire_services_to_customers.php test thirdparties';
|
$script=dirname(__FILE__).'/../../scripts/contracts/email_expire_services_to_customers.php test thirdparties';
|
||||||
$result=exec($script, $output, $returnvar);
|
$result=exec($script, $output, $returnvar);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
@@ -242,6 +251,9 @@ class ScriptsTest extends PHPUnit\Framework\TestCase
|
|||||||
$langs=$this->savlangs;
|
$langs=$this->savlangs;
|
||||||
$db=$this->savdb;
|
$db=$this->savdb;
|
||||||
|
|
||||||
|
$returnvar = 0;
|
||||||
|
$output = array();
|
||||||
|
|
||||||
$script=dirname(__FILE__).'/../../scripts/invoices/email_unpaid_invoices_to_customers.php test thirdparties';
|
$script=dirname(__FILE__).'/../../scripts/invoices/email_unpaid_invoices_to_customers.php test thirdparties';
|
||||||
$result=exec($script, $output, $returnvar);
|
$result=exec($script, $output, $returnvar);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user