forked from Wavyzz/dolibarr
Fix: Enhance repair tool
Qual: Remove a TODO.
This commit is contained in:
@@ -50,6 +50,15 @@ include_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
|
||||
define (GEN_NUMBER_COMMANDE, 10);
|
||||
|
||||
|
||||
$ret=$user->fetch('','admin');
|
||||
if ($ret <= 0)
|
||||
{
|
||||
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
|
||||
exit;
|
||||
}
|
||||
$user->getrights();
|
||||
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
@@ -152,24 +161,33 @@ require(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
|
||||
print "Build ".GEN_NUMBER_COMMANDE." orders\n";
|
||||
for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++)
|
||||
{
|
||||
print "Order ".$s;
|
||||
print "Process order ".$s."\n";
|
||||
|
||||
$com = new Commande($db);
|
||||
|
||||
$com->socid = 4;
|
||||
$com->date_commande = $dates[rand(1, sizeof($dates)-1)];
|
||||
$com->note = $_POST["note"];
|
||||
$com->note = 'A comment';
|
||||
$com->source = 1;
|
||||
$com->fk_project = 0;
|
||||
$com->remise_percent = 0;
|
||||
|
||||
$db->begin();
|
||||
|
||||
$result=$com->create($user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$result=$com->valid($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$nbp = rand(2, 5);
|
||||
$xnbp = 0;
|
||||
while ($xnbp < $nbp)
|
||||
{
|
||||
// \TODO Utiliser addline plutot que add_product
|
||||
$prodid = rand(1, $num_prods);
|
||||
$result=$com->add_product($prodids[$prodid],rand(1,11),rand(1,6),rand(0,20));
|
||||
$product=new Product($db);
|
||||
$result=$product->fetch($prodids[$prodid]);
|
||||
$result=$com->addline($com->id, $product->description, $product->price, rand(1,5), 0, 0, 0, $prodids[$prodid], 0, 0, 0, $product->price_base_type, $product->price_ttc, '', '', $product->type);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db,$propal->error);
|
||||
@@ -177,22 +195,22 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++)
|
||||
$xnbp++;
|
||||
}
|
||||
|
||||
$result=$com->create($user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$result=$com->valid($user);
|
||||
if ($result) print " OK";
|
||||
$db->commit();
|
||||
print " OK with ref ".$com->ref."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print " KO\n";
|
||||
$db->rollback();
|
||||
dol_print_error($db,$com->error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print " KO\n";
|
||||
$db->rollback();
|
||||
dol_print_error($db,$com->error);
|
||||
}
|
||||
|
||||
print "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -113,7 +113,7 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0)
|
||||
$prodid = rand(1, $num_prods);
|
||||
$product=new Product($db);
|
||||
$result=$product->fetch($prodids[$prodid]);
|
||||
$result=$facture->addline($facture->id,$product->description,$product->price, rand(1,5), 0, 0, $product->localtax2_tx, $prodids[$prodid], 0, '', '', 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
|
||||
$result=$facture->addline($facture->id,$product->description,$product->price, rand(1,5), 0, 0, 0, $prodids[$prodid], 0, '', '', 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
|
||||
$xnbp++;
|
||||
}
|
||||
|
||||
|
||||
@@ -130,6 +130,7 @@ class Commande extends CommonObject
|
||||
|
||||
// Chargement de la classe de numerotation
|
||||
$classname = $conf->global->COMMANDE_ADDON;
|
||||
|
||||
$result=include_once($dir.'/'.$file);
|
||||
if ($result)
|
||||
{
|
||||
@@ -630,6 +631,8 @@ class Commande extends CommonObject
|
||||
{
|
||||
if ($this->id)
|
||||
{
|
||||
$this->ref="(PROV".$this->id.")";
|
||||
|
||||
// Add linked object
|
||||
if ($this->origin && $this->origin_id)
|
||||
{
|
||||
@@ -641,7 +644,7 @@ class Commande extends CommonObject
|
||||
if ($this->origin == 'propal' && $this->origin_id)
|
||||
{
|
||||
// On recupere les differents contact interne et externe
|
||||
$prop = New Propal($this->db, $this->socid, $this->origin_id);
|
||||
$prop = new Propal($this->db, $this->socid, $this->origin_id);
|
||||
|
||||
// On recupere le commercial suivi propale
|
||||
$this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL');
|
||||
@@ -788,9 +791,9 @@ class Commande extends CommonObject
|
||||
* @param date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
|
||||
* @param type Type of line (0=product, 1=service)
|
||||
* @param rang Position of line
|
||||
* @return int >0 si ok, <0 si ko
|
||||
* @return int >0 if OK, <0 if KO
|
||||
* @see add_product
|
||||
* @remarks Les parametres sont deja cense etre juste et avec valeurs finales a l'appel
|
||||
* Les parametres sont deja cense etre juste et avec valeurs finales a l'appel
|
||||
* de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini
|
||||
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
|
||||
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
|
||||
|
||||
@@ -140,7 +140,7 @@ if ($ok)
|
||||
//print '<td align="right">'.join('.',$versionarray).'</td></tr>';
|
||||
}
|
||||
|
||||
// Force l'affichage de la progression
|
||||
// Force l'affichage de la progression
|
||||
print '<tr><td colspan="2">'.$langs->trans("PleaseBePatient").'</td></tr>';
|
||||
flush();
|
||||
|
||||
|
||||
@@ -40,12 +40,14 @@ function versiontostring($versionarray)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Compare 2 versions
|
||||
* \param versionarray1 Array of version (vermajor,verminor,patch)
|
||||
* \param versionarray2 Array of version (vermajor,verminor,patch)
|
||||
* \return int -4,-3,-2,-1 if versionarray1<versionarray2 (value depends on level of difference)
|
||||
* Compare 2 versions
|
||||
* @param versionarray1 Array of version (vermajor,verminor,patch)
|
||||
* @param versionarray2 Array of version (vermajor,verminor,patch)
|
||||
* @return int -4,-3,-2,-1 if versionarray1<versionarray2 (value depends on level of difference)
|
||||
* 0 if =
|
||||
* 1,2,3,4 if versionarray1>versionarray2 (value depends on level of difference)
|
||||
*
|
||||
* TODO
|
||||
*/
|
||||
function versioncompare($versionarray1,$versionarray2)
|
||||
{
|
||||
|
||||
@@ -1976,7 +1976,6 @@ function dol_print_error($db='',$error='')
|
||||
$syslog.=", msg=".$msg;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($dolibarr_main_prod) && $_SERVER['DOCUMENT_ROOT'] && function_exists('xdebug_call_file'))
|
||||
{
|
||||
xdebug_print_function_stack();
|
||||
|
||||
Reference in New Issue
Block a user