A lot of fix on point of sale module
This commit is contained in:
parent
3cb6df16fd
commit
538736bedb
@ -54,6 +54,15 @@ else
|
|||||||
define('LOG_INFO',6);
|
define('LOG_INFO',6);
|
||||||
define('LOG_DEBUG',7);
|
define('LOG_DEBUG',7);
|
||||||
}
|
}
|
||||||
|
// Definition of missing functions
|
||||||
|
if (! function_exists("preg_replace"))
|
||||||
|
{
|
||||||
|
function preg_replace($a,$b,$c)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Forcage du parametrage PHP error_reporting (Dolibarr non utilisable en mode error E_ALL)
|
// Forcage du parametrage PHP error_reporting (Dolibarr non utilisable en mode error E_ALL)
|
||||||
error_reporting(E_ALL ^ E_NOTICE);
|
error_reporting(E_ALL ^ E_NOTICE);
|
||||||
@ -80,15 +89,16 @@ if (empty($dolibarr_main_data_root))
|
|||||||
$dolibarr_main_data_root=str_replace("/htdocs","",$dolibarr_main_document_root);
|
$dolibarr_main_data_root=str_replace("/htdocs","",$dolibarr_main_document_root);
|
||||||
$dolibarr_main_data_root.="/documents";
|
$dolibarr_main_data_root.="/documents";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define some constants
|
// Define some constants
|
||||||
define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem pages php (htdocs)
|
define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem pages php (htdocs)
|
||||||
define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem donnes (documents)
|
define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem donnes (documents)
|
||||||
if ($dolibarr_main_url_root == 'auto' && ! empty($_SERVER["SCRIPT_URL"]) && ! empty($_SERVER["SCRIPT_URI"]))
|
if ($dolibarr_main_url_root == 'auto' && ! empty($_SERVER["SCRIPT_URL"]) && ! empty($_SERVER["SCRIPT_URI"]))
|
||||||
{
|
{
|
||||||
$dolibarr_main_url_root=preg_replace('/'.$_SERVER["SCRIPT_URL"].'$/i','',$_SERVER["SCRIPT_URI"]);
|
$dolibarr_main_url_root=str_replace($_SERVER["SCRIPT_URL"],'',$_SERVER["SCRIPT_URI"]);
|
||||||
}
|
}
|
||||||
define('DOL_MAIN_URL_ROOT', $dolibarr_main_url_root); // URL relative root
|
define('DOL_MAIN_URL_ROOT', $dolibarr_main_url_root); // URL relative root
|
||||||
$uri=preg_replace('/^http(s?):\/\//i','',$dolibarr_main_url_root); // $suburi contains url without http*
|
$uri=preg_replace('/^http(s?):\/\//i','',$dolibarr_main_url_root); // $uri contains url without http*
|
||||||
$suburi = strstr ($uri, '/'); // $suburi contains url without domain
|
$suburi = strstr ($uri, '/'); // $suburi contains url without domain
|
||||||
if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now ''
|
if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now ''
|
||||||
define('DOL_URL_ROOT', $suburi); // URL relative root ('/', '/dolibarr', ...)
|
define('DOL_URL_ROOT', $suburi); // URL relative root ('/', '/dolibarr', ...)
|
||||||
@ -96,8 +106,9 @@ if (! empty($dolibarr_main_url_root_static)) define('DOL_URL_ROOT_FULL_STATIC',
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Controle validite fichier conf
|
* Include functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (! file_exists(DOL_DOCUMENT_ROOT ."/lib/functions.lib.php"))
|
if (! file_exists(DOL_DOCUMENT_ROOT ."/lib/functions.lib.php"))
|
||||||
{
|
{
|
||||||
print "Error: Dolibarr config file content seems to be not correctly defined.<br>\n";
|
print "Error: Dolibarr config file content seems to be not correctly defined.<br>\n";
|
||||||
@ -105,13 +116,9 @@ if (! file_exists(DOL_DOCUMENT_ROOT ."/lib/functions.lib.php"))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create $conf object
|
|
||||||
*/
|
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/lib/functions.lib.php"); // Need 970ko memory (1.1 in 2.2)
|
require_once(DOL_DOCUMENT_ROOT ."/lib/functions.lib.php"); // Need 970ko memory (1.1 in 2.2)
|
||||||
|
|
||||||
|
|
||||||
// If password is encoded, we decode it
|
// If password is encoded, we decode it
|
||||||
if (preg_match('/crypted:/i',$dolibarr_main_db_pass) || ! empty($dolibarr_main_db_encrypted_pass))
|
if (preg_match('/crypted:/i',$dolibarr_main_db_pass) || ! empty($dolibarr_main_db_encrypted_pass))
|
||||||
{
|
{
|
||||||
@ -126,6 +133,11 @@ if (preg_match('/crypted:/i',$dolibarr_main_db_pass) || ! empty($dolibarr_main_d
|
|||||||
}
|
}
|
||||||
//print memory_get_usage();
|
//print memory_get_usage();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create $conf object
|
||||||
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/conf.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/conf.class.php");
|
||||||
|
|
||||||
$conf = new Conf();
|
$conf = new Conf();
|
||||||
@ -408,4 +420,19 @@ if (! defined('MAGPIE_CACHE_DIR')) { define('MAGPIE_CACHE_DIR', $conf->exte
|
|||||||
|
|
||||||
|
|
||||||
if (! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR');
|
if (! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a string into a regex
|
||||||
|
*
|
||||||
|
* @param unknown_type $s string to convert
|
||||||
|
*/
|
||||||
|
function dol_regify($s)
|
||||||
|
{
|
||||||
|
$news=str_replace('/','\/',$s);
|
||||||
|
$news=str_replace('.','\.',$news);
|
||||||
|
$news=str_replace('*','\*',$news);
|
||||||
|
return $news;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -88,6 +88,7 @@ class Paiement
|
|||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->ref = $obj->rowid;
|
$this->ref = $obj->rowid;
|
||||||
$this->date = $obj->dp;
|
$this->date = $obj->dp;
|
||||||
|
$this->datepaye = $obj->dp;
|
||||||
$this->numero = $obj->num_paiement;
|
$this->numero = $obj->num_paiement;
|
||||||
$this->bank_account = $obj->fk_account;
|
$this->bank_account = $obj->fk_account;
|
||||||
$this->bank_line = $obj->fk_bank;
|
$this->bank_line = $obj->fk_bank;
|
||||||
@ -114,9 +115,9 @@ class Paiement
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Creation du paiement en base
|
* \brief Create payment in database
|
||||||
* \param user object utilisateur qui cree
|
* \param user object user
|
||||||
* \return int id du paiement cree, < 0 si erreur
|
* \return int id of created payment, < 0 if error
|
||||||
*/
|
*/
|
||||||
function create($user)
|
function create($user)
|
||||||
{
|
{
|
||||||
@ -124,14 +125,13 @@ class Paiement
|
|||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// Nettoyage parametres
|
// Clean parameters
|
||||||
$this->total = 0;
|
$this->total = 0;
|
||||||
foreach ($this->amounts as $key => $value)
|
foreach ($this->amounts as $key => $value) // How payment is dispatch
|
||||||
{
|
{
|
||||||
$value = price2num($value);
|
$value = price2num($value,'MT');
|
||||||
$val = round($value, 2);
|
$this->amounts[$key] = $value;
|
||||||
$this->amounts[$key] = $val;
|
$this->total += $value;
|
||||||
$this->total += $val;
|
|
||||||
}
|
}
|
||||||
$this->total = price2num($this->total);
|
$this->total = price2num($this->total);
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ class Paiement
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog('Paiement::Create Montant non numérique');
|
dol_syslog('Paiement::Create Montant non numerique');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user